Skip to content

Commit caa94e9

Browse files
author
Isaac
committed
Revert "Various fixes"
This reverts commit 4b74d1c.
1 parent 4b74d1c commit caa94e9

File tree

14 files changed

+31
-214
lines changed

14 files changed

+31
-214
lines changed

submodules/AccountContext/Sources/AttachmentMainButtonState.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public struct AttachmentMainButtonState {
3333
}
3434

3535
public let text: String?
36-
public let badge: String?
3736
public let font: Font
3837
public let background: Background
3938
public let textColor: UIColor
@@ -45,7 +44,6 @@ public struct AttachmentMainButtonState {
4544

4645
public init(
4746
text: String?,
48-
badge: String? = nil,
4947
font: Font,
5048
background: Background,
5149
textColor: UIColor,
@@ -56,7 +54,6 @@ public struct AttachmentMainButtonState {
5654
position: Position? = nil
5755
) {
5856
self.text = text
59-
self.badge = badge
6057
self.font = font
6158
self.background = background
6259
self.textColor = textColor

submodules/AccountContext/Sources/ContactMultiselectionController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public enum ContactMultiselectionControllerMode {
7979
case channelCreation
8080
case chatSelection(ChatSelection)
8181
case premiumGifting(birthdays: [EnginePeer.Id: TelegramBirthday]?, selectToday: Bool, hasActions: Bool)
82-
case requestedUsersSelection(isBot: Bool?, isPremium: Bool?)
82+
case requestedUsersSelection
8383
}
8484

8585
public enum ContactListFilter {

submodules/AccountContext/Sources/PeerSelectionController.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public final class PeerSelectionControllerParams {
5959
public let createNewGroup: (() -> Void)?
6060
public let pretendPresentedInModal: Bool
6161
public let multipleSelection: Bool
62-
public let multipleSelectionLimit: Int32?
6362
public let forwardedMessageIds: [EngineMessage.Id]
6463
public let hasTypeHeaders: Bool
6564
public let selectForumThreads: Bool
@@ -81,7 +80,6 @@ public final class PeerSelectionControllerParams {
8180
createNewGroup: (() -> Void)? = nil,
8281
pretendPresentedInModal: Bool = false,
8382
multipleSelection: Bool = false,
84-
multipleSelectionLimit: Int32? = nil,
8583
forwardedMessageIds: [EngineMessage.Id] = [],
8684
hasTypeHeaders: Bool = false,
8785
selectForumThreads: Bool = false,
@@ -102,7 +100,6 @@ public final class PeerSelectionControllerParams {
102100
self.createNewGroup = createNewGroup
103101
self.pretendPresentedInModal = pretendPresentedInModal
104102
self.multipleSelection = multipleSelection
105-
self.multipleSelectionLimit = multipleSelectionLimit
106103
self.forwardedMessageIds = forwardedMessageIds
107104
self.hasTypeHeaders = hasTypeHeaders
108105
self.selectForumThreads = selectForumThreads

submodules/AttachmentUI/Sources/AttachmentPanel.swift

Lines changed: 7 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -382,102 +382,12 @@ private final class LoadingProgressNode: ASDisplayNode {
382382
}
383383
}
384384

385-
private final class BadgeNode: ASDisplayNode {
386-
private var fillColor: UIColor
387-
private var strokeColor: UIColor
388-
private var textColor: UIColor
389-
390-
private let textNode: ImmediateTextNode
391-
private let backgroundNode: ASImageNode
392-
393-
private let font: UIFont = Font.with(size: 15.0, design: .round, weight: .bold)
394-
395-
var text: String = "" {
396-
didSet {
397-
self.textNode.attributedText = NSAttributedString(string: self.text, font: self.font, textColor: self.textColor)
398-
self.invalidateCalculatedLayout()
399-
}
400-
}
401-
402-
init(fillColor: UIColor, strokeColor: UIColor, textColor: UIColor) {
403-
self.fillColor = fillColor
404-
self.strokeColor = strokeColor
405-
self.textColor = textColor
406-
407-
self.textNode = ImmediateTextNode()
408-
self.textNode.isUserInteractionEnabled = false
409-
self.textNode.displaysAsynchronously = false
410-
411-
self.backgroundNode = ASImageNode()
412-
self.backgroundNode.isLayerBacked = true
413-
self.backgroundNode.displayWithoutProcessing = true
414-
self.backgroundNode.displaysAsynchronously = false
415-
self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 18.0, color: fillColor, strokeColor: nil, strokeWidth: 1.0)
416-
417-
super.init()
418-
419-
self.addSubnode(self.backgroundNode)
420-
self.addSubnode(self.textNode)
421-
422-
self.isUserInteractionEnabled = false
423-
}
424-
425-
func updateTheme(fillColor: UIColor, strokeColor: UIColor, textColor: UIColor) {
426-
self.fillColor = fillColor
427-
self.strokeColor = strokeColor
428-
self.textColor = textColor
429-
self.backgroundNode.image = generateStretchableFilledCircleImage(diameter: 18.0, color: fillColor, strokeColor: strokeColor, strokeWidth: 1.0)
430-
self.textNode.attributedText = NSAttributedString(string: self.text, font: self.font, textColor: self.textColor)
431-
}
432-
433-
func animateBump(incremented: Bool) {
434-
if incremented {
435-
let firstTransition = ContainedViewLayoutTransition.animated(duration: 0.1, curve: .easeInOut)
436-
firstTransition.updateTransformScale(layer: self.backgroundNode.layer, scale: 1.2)
437-
firstTransition.updateTransformScale(layer: self.textNode.layer, scale: 1.2, completion: { finished in
438-
if finished {
439-
let secondTransition = ContainedViewLayoutTransition.animated(duration: 0.1, curve: .easeInOut)
440-
secondTransition.updateTransformScale(layer: self.backgroundNode.layer, scale: 1.0)
441-
secondTransition.updateTransformScale(layer: self.textNode.layer, scale: 1.0)
442-
}
443-
})
444-
} else {
445-
let firstTransition = ContainedViewLayoutTransition.animated(duration: 0.1, curve: .easeInOut)
446-
firstTransition.updateTransformScale(layer: self.backgroundNode.layer, scale: 0.8)
447-
firstTransition.updateTransformScale(layer: self.textNode.layer, scale: 0.8, completion: { finished in
448-
if finished {
449-
let secondTransition = ContainedViewLayoutTransition.animated(duration: 0.1, curve: .easeInOut)
450-
secondTransition.updateTransformScale(layer: self.backgroundNode.layer, scale: 1.0)
451-
secondTransition.updateTransformScale(layer: self.textNode.layer, scale: 1.0)
452-
}
453-
})
454-
}
455-
}
456-
457-
func animateOut() {
458-
let timingFunction = CAMediaTimingFunctionName.easeInEaseOut.rawValue
459-
self.backgroundNode.layer.animateScale(from: 1.0, to: 0.1, duration: 0.3, delay: 0.0, timingFunction: timingFunction, removeOnCompletion: true, completion: nil)
460-
self.textNode.layer.animateScale(from: 1.0, to: 0.1, duration: 0.3, delay: 0.0, timingFunction: timingFunction, removeOnCompletion: true, completion: nil)
461-
}
462-
463-
func update(_ constrainedSize: CGSize) -> CGSize {
464-
let badgeSize = self.textNode.updateLayout(constrainedSize)
465-
let backgroundSize = CGSize(width: max(18.0, badgeSize.width + 8.0), height: 18.0)
466-
let backgroundFrame = CGRect(origin: CGPoint(), size: backgroundSize)
467-
self.backgroundNode.frame = backgroundFrame
468-
self.textNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels(backgroundFrame.midX - badgeSize.width / 2.0), y: floorToScreenPixels((backgroundFrame.size.height - badgeSize.height) / 2.0) - UIScreenPixel), size: badgeSize)
469-
470-
return backgroundSize
471-
}
472-
}
473-
474385
private final class MainButtonNode: HighlightTrackingButtonNode {
475386
private var state: AttachmentMainButtonState
476387
private var size: CGSize?
477388

478389
private let backgroundAnimationNode: ASImageNode
479390
fileprivate let textNode: ImmediateTextNode
480-
private var badgeNode: BadgeNode?
481391
private let statusNode: SemanticStatusNode
482392
private var progressNode: ASImageNode?
483393

@@ -706,7 +616,6 @@ private final class MainButtonNode: HighlightTrackingButtonNode {
706616
progressNode.image = generateIndefiniteActivityIndicatorImage(color: state.textColor, diameter: diameter, lineWidth: 3.0)
707617
}
708618

709-
var textFrame: CGRect = .zero
710619
if let text = state.text {
711620
let font: UIFont
712621
switch state.font {
@@ -718,7 +627,13 @@ private final class MainButtonNode: HighlightTrackingButtonNode {
718627
self.textNode.attributedText = NSAttributedString(string: text, font: font, textColor: state.textColor)
719628

720629
let textSize = self.textNode.updateLayout(size)
721-
textFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: floorToScreenPixels((size.height - textSize.height) / 2.0)), size: textSize)
630+
let textFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - textSize.width) / 2.0), y: floorToScreenPixels((size.height - textSize.height) / 2.0)), size: textSize)
631+
if self.textNode.frame.width.isZero {
632+
self.textNode.frame = textFrame
633+
} else {
634+
self.textNode.bounds = CGRect(origin: .zero, size: textSize)
635+
transition.updatePosition(node: self.textNode, position: textFrame.center)
636+
}
722637

723638
switch state.background {
724639
case let .color(backgroundColor):
@@ -754,40 +669,6 @@ private final class MainButtonNode: HighlightTrackingButtonNode {
754669
}
755670
}
756671

757-
if let badge = state.badge {
758-
let badgeNode: BadgeNode
759-
var badgeTransition = transition
760-
if let current = self.badgeNode {
761-
badgeNode = current
762-
} else {
763-
badgeTransition = .immediate
764-
var textColor: UIColor
765-
switch state.background {
766-
case let .color(backgroundColor):
767-
textColor = backgroundColor
768-
case .premium:
769-
textColor = UIColor(rgb: 0x0077ff)
770-
}
771-
badgeNode = BadgeNode(fillColor: state.textColor, strokeColor: .clear, textColor: textColor)
772-
self.badgeNode = badgeNode
773-
self.addSubnode(badgeNode)
774-
}
775-
badgeNode.text = badge
776-
let badgeSize = badgeNode.update(CGSize(width: 100.0, height: 100.0))
777-
textFrame.origin.x -= badgeSize.width / 2.0
778-
badgeTransition.updateFrame(node: badgeNode, frame: CGRect(origin: CGPoint(x: textFrame.maxX + 6.0, y: textFrame.minY + floorToScreenPixels((textFrame.height - badgeSize.height) * 0.5)), size: badgeSize))
779-
} else if let badgeNode = self.badgeNode {
780-
self.badgeNode = nil
781-
badgeNode.removeFromSupernode()
782-
}
783-
784-
if self.textNode.frame.width.isZero {
785-
self.textNode.frame = textFrame
786-
} else {
787-
self.textNode.bounds = CGRect(origin: .zero, size: textFrame.size)
788-
transition.updatePosition(node: self.textNode, position: textFrame.center)
789-
}
790-
791672
if previousState.progress != state.progress {
792673
if state.progress == .center {
793674
self.transitionToProgress()

submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,9 +2477,6 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
24772477
case let .user(userType):
24782478
if case let .user(user) = peer {
24792479
match = true
2480-
if user.id.isVerificationCodes {
2481-
match = false
2482-
}
24832480
if let isBot = userType.isBot {
24842481
if isBot != (user.botInfo != nil) {
24852482
match = false

submodules/ChatListUI/Sources/Node/ChatListItem.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -878,10 +878,14 @@ private final class ChatListMediaPreviewNode: ASDisplayNode {
878878
if file.isInstantVideo {
879879
isRound = true
880880
}
881-
if file.isVideo && !file.isAnimated {
882-
self.playIcon.isHidden = false
883-
} else {
881+
if file.isSticker || file.isAnimatedSticker {
884882
self.playIcon.isHidden = true
883+
} else {
884+
if file.isAnimated {
885+
self.playIcon.isHidden = true
886+
} else {
887+
self.playIcon.isHidden = false
888+
}
885889
}
886890
if let mediaDimensions = file.dimensions {
887891
dimensions = mediaDimensions.cgSize
@@ -2642,9 +2646,6 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
26422646
} else if contentImageIsDisplayedAsAvatar && (file.isSticker || file.isVideoSticker) {
26432647
let fitSize = contentImageSize
26442648
contentImageSpecs.append(ContentImageSpec(message: message, media: .file(file), size: fitSize))
2645-
} else if !file.previewRepresentations.isEmpty, let _ = file.dimensions {
2646-
let fitSize = contentImageSize
2647-
contentImageSpecs.append(ContentImageSpec(message: message, media: .file(file), size: fitSize))
26482649
}
26492650
break inner
26502651
} else if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {

submodules/ChatListUI/Sources/Node/ChatListNode.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,9 +2444,6 @@ public final class ChatListNode: ListView {
24442444
case let .user(userType):
24452445
if case let .user(user) = peer {
24462446
match = true
2447-
if user.id.isVerificationCodes {
2448-
match = false
2449-
}
24502447
if let isBot = userType.isBot {
24512448
if isBot != (user.botInfo != nil) {
24522449
match = false

submodules/CounterControllerTitleView/Sources/CounterControllerTitleView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public final class CounterControllerTitleView: UIView {
5959
let primaryTextColor = self.primaryTextColor ?? self.theme.rootController.navigationBar.primaryTextColor
6060
let secondaryTextColor = self.secondaryTextColor ?? self.theme.rootController.navigationBar.secondaryTextColor
6161
self.titleNode.attributedText = NSAttributedString(string: self.title.title, font: Font.semibold(17.0), textColor: primaryTextColor)
62-
self.subtitleNode.attributedText = NSAttributedString(string: self.title.counter, font: Font.with(size: 13.0, traits: .monospacedNumbers), textColor: secondaryTextColor)
62+
self.subtitleNode.attributedText = NSAttributedString(string: self.title.counter, font: Font.regular(13.0), textColor: secondaryTextColor)
6363

6464
self.accessibilityLabel = self.title.title
6565
self.accessibilityValue = self.title.counter

submodules/LegacyComponents/Sources/TGPhotoEditorSliderView.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,7 @@ - (void)setValue:(CGFloat)value
381381

382382
- (void)setValue:(CGFloat)value animated:(BOOL)__unused animated
383383
{
384-
if (_lowerBoundValue > FLT_EPSILON) {
385-
_value = MIN(MAX(_lowerBoundValue, MAX(value, _minimumValue)), _maximumValue);
386-
} else {
387-
_value = MIN(MAX(value, _minimumValue), _maximumValue);
388-
}
384+
_value = MIN(MAX(_lowerBoundValue, MAX(value, _minimumValue)), _maximumValue);
389385
[self setNeedsLayout];
390386
}
391387

submodules/StickerPackPreviewUI/Sources/StickerPackEmojisItem.swift

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -297,24 +297,9 @@ final class StickerPackEmojisItemNode: GridItemNode {
297297

298298
self.setNeedsLayout()
299299
}
300-
301-
private var visibleRect: CGRect?
302-
override func updateAbsoluteRect(_ absoluteRect: CGRect, within containerSize: CGSize) {
303-
var y: CGFloat
304-
if absoluteRect.minY > 0.0 {
305-
y = 0.0
306-
} else {
307-
y = absoluteRect.minY * -1.0
308-
}
309-
var rect = CGRect(origin: CGPoint(x: 0.0, y: y), size: CGSize(width: containerSize.width, height: containerSize.height))
310-
rect.size.height += 96.0
311-
self.visibleRect = rect
312-
313-
self.updateVisibleItems(attemptSynchronousLoads: false, transition: .immediate)
314-
}
315300

316301
func updateVisibleItems(attemptSynchronousLoads: Bool, transition: ContainedViewLayoutTransition) {
317-
guard let item = self.item, !self.size.width.isZero, let visibleRect = self.visibleRect else {
302+
guard let item = self.item, !self.size.width.isZero else {
318303
return
319304
}
320305

@@ -336,26 +321,17 @@ final class StickerPackEmojisItemNode: GridItemNode {
336321
self.containerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: item.title != nil ? 61.0 : 0.0), size: CGSize(width: itemLayout.width, height: itemLayout.height))
337322

338323
for index in 0 ..< items.count {
339-
var itemFrame = itemLayout.frame(itemIndex: index)
340-
if !visibleRect.intersects(itemFrame) {
341-
continue
342-
}
343324
let item = items[index]
344325
let itemId = EmojiKeyboardItemLayer.Key(
345326
groupId: 0,
346327
itemId: .animation(.file(item.file.fileId))
347328
)
329+
validIds.insert(itemId)
348330

349331
let itemDimensions = item.file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0)
350332
let itemNativeFitSize = itemDimensions.fitted(CGSize(width: nativeItemSize, height: nativeItemSize))
351333
let itemVisibleFitSize = itemDimensions.fitted(CGSize(width: itemLayout.visibleItemSize, height: itemLayout.visibleItemSize))
352334

353-
validIds.insert(itemId)
354-
355-
itemFrame.origin.x += floor((itemFrame.width - itemVisibleFitSize.width) / 2.0)
356-
itemFrame.origin.y += floor((itemFrame.height - itemVisibleFitSize.height) / 2.0)
357-
itemFrame.size = itemVisibleFitSize
358-
359335
var updateItemLayerPlaceholder = false
360336
var itemTransition = transition
361337
let itemLayer: EmojiKeyboardItemLayer
@@ -450,6 +426,12 @@ final class StickerPackEmojisItemNode: GridItemNode {
450426
itemLayer.layerTintColor = color.cgColor
451427
}
452428

429+
var itemFrame = itemLayout.frame(itemIndex: index)
430+
431+
itemFrame.origin.x += floor((itemFrame.width - itemVisibleFitSize.width) / 2.0)
432+
itemFrame.origin.y += floor((itemFrame.height - itemVisibleFitSize.height) / 2.0)
433+
itemFrame.size = itemVisibleFitSize
434+
453435
let itemPosition = CGPoint(x: itemFrame.midX, y: itemFrame.midY)
454436
let itemBounds = CGRect(origin: CGPoint(), size: itemFrame.size)
455437
itemTransition.updatePosition(layer: itemLayer, position: itemPosition)

0 commit comments

Comments
 (0)