Various Improvements

This commit is contained in:
Ilya Laktyushin
2021-01-17 10:18:10 +03:00
parent fadd3abea6
commit fa125d0192
124 changed files with 12748 additions and 5704 deletions

View File

@@ -3,10 +3,16 @@ import UIKit
import AsyncDisplayKit
import SwiftSignalKit
public protocol TooltipControllerCustomContentNode: ASDisplayNode {
func animateIn()
func updateLayout(size: CGSize) -> CGSize
}
public enum TooltipControllerContent: Equatable {
case text(String)
case attributedText(NSAttributedString)
case iconAndText(UIImage, String)
case custom(TooltipControllerCustomContentNode)
var text: String {
switch self {
@@ -14,6 +20,8 @@ public enum TooltipControllerContent: Equatable {
return text
case let .attributedText(text):
return text.string
case .custom:
return ""
}
}
@@ -23,6 +31,35 @@ public enum TooltipControllerContent: Equatable {
}
return nil
}
public static func == (lhs: TooltipControllerContent, rhs: TooltipControllerContent) -> Bool {
switch lhs {
case let .text(lhsText):
if case let .text(rhsText) = rhs, lhsText == rhsText {
return true
} else {
return false
}
case let .attributedText(lhsText):
if case let .attributedText(rhsText) = rhs, lhsText == rhsText {
return true
} else {
return false
}
case let .iconAndText(_, lhsText):
if case let .iconAndText(_, rhsText) = rhs, lhsText == rhsText {
return true
} else {
return false
}
case let .custom(lhsNode):
if case let .custom(rhsNode) = rhs, lhsNode === rhsNode {
return true
} else {
return false
}
}
}
}
public enum SourceAndRect {