Moderation sheet improvements

This commit is contained in:
Isaac 2024-04-19 00:00:04 +04:00
parent b4e1173279
commit 2d65b3d90b
21 changed files with 1183 additions and 241 deletions

View file

@ -69,6 +69,8 @@ open class IconSwitchNode: ASDisplayNode {
}
}
private var _isLocked: Bool = false
override public init() {
super.init()
@ -82,8 +84,8 @@ open class IconSwitchNode: ASDisplayNode {
(self.view as! UISwitch).backgroundColor = self.backgroundColor
(self.view as! UISwitch).tintColor = self.frameColor
//(self.view as! UISwitch).thumbTintColor = self.handleColor
(self.view as! UISwitch).onTintColor = self.contentColor
(self.view as? TGIconSwitchView)?.updateIsLocked(self._isLocked)
(self.view as! IconSwitchNodeView).setNegativeContentColor(self.negativeContentColor)
(self.view as! IconSwitchNodeView).setPositiveContentColor(self.positiveContentColor)
@ -99,6 +101,16 @@ open class IconSwitchNode: ASDisplayNode {
}
}
public func updateIsLocked(_ value: Bool) {
if self._isLocked == value {
return
}
self._isLocked = value
if self.isNodeLoaded {
(self.view as? TGIconSwitchView)?.updateIsLocked(value)
}
}
override open func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
return CGSize(width: 51.0, height: 31.0)
}