mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '5597eacb4eaeb0cd55cea0dfa8a0259c3a7febf1'
This commit is contained in:
commit
c2ef0d70a7
@ -41,6 +41,7 @@ public class ActionSheetPeerItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,8 +133,6 @@ public class ActionSheetPeerItemNode: ActionSheetItemNode {
|
|||||||
}
|
}
|
||||||
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
||||||
self.accessibilityArea.accessibilityLabel = item.title
|
self.accessibilityArea.accessibilityLabel = item.title
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -155,7 +154,7 @@ public class ActionSheetPeerItemNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,7 @@ public class BotCheckoutPaymentMethodItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,8 +210,6 @@ public class BotCheckoutPaymentMethodItemNode: ActionSheetItemNode {
|
|||||||
} else {
|
} else {
|
||||||
self.checkNode.isHidden = true
|
self.checkNode.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -237,7 +236,7 @@ public class BotCheckoutPaymentMethodItemNode: ActionSheetItemNode {
|
|||||||
self.checkNode.frame = CGRect(origin: CGPoint(x: floor((44.0 - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size)
|
self.checkNode.frame = CGRect(origin: CGPoint(x: floor((44.0 - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,7 @@ public class BotCheckoutPaymentShippingOptionItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +187,6 @@ public class BotCheckoutPaymentShippingOptionItemNode: ActionSheetItemNode {
|
|||||||
} else {
|
} else {
|
||||||
self.checkNode.isHidden = true
|
self.checkNode.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -209,7 +208,7 @@ public class BotCheckoutPaymentShippingOptionItemNode: ActionSheetItemNode {
|
|||||||
self.checkNode.frame = CGRect(origin: CGPoint(x: floor((44.0 - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size)
|
self.checkNode.frame = CGRect(origin: CGPoint(x: floor((44.0 - image.size.width) / 2.0), y: floor((size.height - image.size.height) / 2.0)), size: image.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ private final class DateSelectionActionSheetItemNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.pickerView.frame = CGRect(origin: CGPoint(), size: size)
|
self.pickerView.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ private final class DeleteChatPeerActionSheetItemNode: ActionSheetItemNode {
|
|||||||
let size = CGSize(width: constrainedSize.width, height: topInset + avatarSize + textSpacing + textSize.height + bottomInset)
|
let size = CGSize(width: constrainedSize.width, height: topInset + avatarSize + textSpacing + textSize.height + bottomInset)
|
||||||
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ public class ActionSheetButtonItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ public class ActionSheetButtonNode: ActionSheetItemNode {
|
|||||||
private let accessibilityArea: AccessibilityAreaNode
|
private let accessibilityArea: AccessibilityAreaNode
|
||||||
|
|
||||||
private var pointerInteraction: PointerInteraction?
|
private var pointerInteraction: PointerInteraction?
|
||||||
|
|
||||||
override public init(theme: ActionSheetControllerTheme) {
|
override public init(theme: ActionSheetControllerTheme) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
|
||||||
@ -148,8 +149,6 @@ public class ActionSheetButtonNode: ActionSheetItemNode {
|
|||||||
accessibilityTraits.insert(.notEnabled)
|
accessibilityTraits.insert(.notEnabled)
|
||||||
}
|
}
|
||||||
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -161,7 +160,7 @@ public class ActionSheetButtonNode: ActionSheetItemNode {
|
|||||||
self.label.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - labelSize.width) / 2.0), y: floorToScreenPixels((size.height - labelSize.height) / 2.0)), size: labelSize)
|
self.label.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - labelSize.width) / 2.0), y: floorToScreenPixels((size.height - labelSize.height) / 2.0)), size: labelSize)
|
||||||
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ public class ActionSheetCheckboxItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,8 +133,6 @@ public class ActionSheetCheckboxItemNode: ActionSheetItemNode {
|
|||||||
accessibilityTraits.insert(.selected)
|
accessibilityTraits.insert(.selected)
|
||||||
}
|
}
|
||||||
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -159,7 +158,7 @@ public class ActionSheetCheckboxItemNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@ final class ActionSheetItemGroupsContainerNode: ASDisplayNode {
|
|||||||
var theme: ActionSheetControllerTheme {
|
var theme: ActionSheetControllerTheme {
|
||||||
didSet {
|
didSet {
|
||||||
self.setGroups(self.groups)
|
self.setGroups(self.groups)
|
||||||
self.setNeedsLayout()
|
if let size = self.validSize {
|
||||||
|
let _ = self.updateLayout(constrainedSize: size, transition: .immediate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,6 +18,8 @@ final class ActionSheetItemGroupsContainerNode: ASDisplayNode {
|
|||||||
|
|
||||||
var requestLayout: (() -> Void)?
|
var requestLayout: (() -> Void)?
|
||||||
|
|
||||||
|
private var validSize: CGSize?
|
||||||
|
|
||||||
init(theme: ActionSheetControllerTheme) {
|
init(theme: ActionSheetControllerTheme) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
|
||||||
@ -46,6 +50,8 @@ final class ActionSheetItemGroupsContainerNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
|
self.validSize = constrainedSize
|
||||||
|
|
||||||
var groupsHeight: CGFloat = 0.0
|
var groupsHeight: CGFloat = 0.0
|
||||||
|
|
||||||
var calculatedSizes: [CGSize] = []
|
var calculatedSizes: [CGSize] = []
|
||||||
|
@ -11,6 +11,8 @@ open class ActionSheetItemNode: ASDisplayNode {
|
|||||||
|
|
||||||
public var requestLayout: (() -> Void)?
|
public var requestLayout: (() -> Void)?
|
||||||
|
|
||||||
|
private var validSize: CGSize?
|
||||||
|
|
||||||
public init(theme: ActionSheetControllerTheme) {
|
public init(theme: ActionSheetControllerTheme) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
|
||||||
@ -28,13 +30,21 @@ open class ActionSheetItemNode: ASDisplayNode {
|
|||||||
|
|
||||||
open func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
open func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
let size = CGSize(width: constrainedSize.width, height: 57.0)
|
let size = CGSize(width: constrainedSize.width, height: 57.0)
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
public func updateInternalLayout(_ calculatedSize: CGSize) {
|
public func updateInternalLayout(_ calculatedSize: CGSize, constrainedSize: CGSize) {
|
||||||
|
self.validSize = constrainedSize
|
||||||
|
|
||||||
self.backgroundNode.frame = CGRect(origin: CGPoint(), size: calculatedSize)
|
self.backgroundNode.frame = CGRect(origin: CGPoint(), size: calculatedSize)
|
||||||
self.overflowSeparatorNode.frame = CGRect(origin: CGPoint(x: 0.0, y: calculatedSize.height), size: CGSize(width: calculatedSize.width, height: UIScreenPixel))
|
self.overflowSeparatorNode.frame = CGRect(origin: CGPoint(x: 0.0, y: calculatedSize.height), size: CGSize(width: calculatedSize.width, height: UIScreenPixel))
|
||||||
self.overflowSeparatorNode.isHidden = !self.hasSeparator
|
self.overflowSeparatorNode.isHidden = !self.hasSeparator
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func requestLayoutUpdate() {
|
||||||
|
if let size = self.validSize {
|
||||||
|
let _ = self.updateLayout(constrainedSize: size, transition: .immediate)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public class ActionSheetSwitchItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,8 +100,6 @@ public class ActionSheetSwitchNode: ActionSheetItemNode {
|
|||||||
accessibilityTraits.insert(.selected)
|
accessibilityTraits.insert(.selected)
|
||||||
}
|
}
|
||||||
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -116,7 +115,7 @@ public class ActionSheetSwitchNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ public class ActionSheetTextItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +66,6 @@ public class ActionSheetTextNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.label.attributedText = NSAttributedString(string: item.title, font: defaultFont, textColor: self.theme.secondaryTextColor, paragraphAlignment: .center)
|
self.label.attributedText = NSAttributedString(string: item.title, font: defaultFont, textColor: self.theme.secondaryTextColor, paragraphAlignment: .center)
|
||||||
self.accessibilityArea.accessibilityLabel = item.title
|
self.accessibilityArea.accessibilityLabel = item.title
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -77,7 +76,7 @@ public class ActionSheetTextNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ private final class OpenInActionSheetItemNode: ActionSheetItemNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,15 +151,15 @@ private enum ChannelBlacklistEntry: ItemListNodeEntry {
|
|||||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||||
let arguments = arguments as! ChannelBlacklistControllerArguments
|
let arguments = arguments as! ChannelBlacklistControllerArguments
|
||||||
switch self {
|
switch self {
|
||||||
case let .add(theme, text):
|
case let .add(_, text):
|
||||||
return ItemListActionItem(presentationData: presentationData, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: {
|
return ItemListActionItem(presentationData: presentationData, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: {
|
||||||
arguments.addPeer()
|
arguments.addPeer()
|
||||||
})
|
})
|
||||||
case let .addInfo(theme, text):
|
case let .addInfo(_, text):
|
||||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||||
case let .bannedHeader(theme, text):
|
case let .bannedHeader(_, text):
|
||||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||||
case let .peerItem(theme, strings, dateTimeFormat, nameDisplayOrder, _, participant, editing, enabled):
|
case let .peerItem(_, strings, dateTimeFormat, nameDisplayOrder, _, participant, editing, enabled):
|
||||||
var text: ItemListPeerItemText = .none
|
var text: ItemListPeerItemText = .none
|
||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case let .member(_, _, _, banInfo, _):
|
case let .member(_, _, _, banInfo, _):
|
||||||
|
@ -107,7 +107,7 @@ private final class ChannelDiscussionGroupActionSheetItemNode: ActionSheetItemNo
|
|||||||
|
|
||||||
let size = CGSize(width: constrainedSize.width, height: topInset + avatarSize + textSpacing + textSize.height + bottomInset)
|
let size = CGSize(width: constrainedSize.width, height: topInset + avatarSize + textSpacing + textSize.height + bottomInset)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,81 +327,81 @@ private enum ChannelInfoEntry: ItemListNodeEntry {
|
|||||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||||
let arguments = arguments as! ChannelInfoControllerArguments
|
let arguments = arguments as! ChannelInfoControllerArguments
|
||||||
switch self {
|
switch self {
|
||||||
case let .info(theme, strings, dateTimeFormat, peer, cachedData, state, updatingAvatar):
|
case let .info(_, _, dateTimeFormat, peer, cachedData, state, updatingAvatar):
|
||||||
return ItemListAvatarAndNameInfoItem(accountContext: arguments.context, presentationData: presentationData, dateTimeFormat: dateTimeFormat, mode: .generic, peer: peer, presence: nil, cachedData: cachedData, state: state, sectionId: self.section, style: .plain, editingNameUpdated: { editingName in
|
return ItemListAvatarAndNameInfoItem(accountContext: arguments.context, presentationData: presentationData, dateTimeFormat: dateTimeFormat, mode: .generic, peer: peer, presence: nil, cachedData: cachedData, state: state, sectionId: self.section, style: .plain, editingNameUpdated: { editingName in
|
||||||
arguments.updateEditingName(editingName)
|
arguments.updateEditingName(editingName)
|
||||||
}, avatarTapped: {
|
}, avatarTapped: {
|
||||||
arguments.tapAvatarAction()
|
arguments.tapAvatarAction()
|
||||||
}, context: arguments.avatarAndNameInfoContext, updatingImage: updatingAvatar)
|
}, context: arguments.avatarAndNameInfoContext, updatingImage: updatingAvatar)
|
||||||
case let .about(theme, text, value):
|
case let .about(_, text, value):
|
||||||
return ItemListTextWithLabelItem(presentationData: presentationData, label: text, text: foldMultipleLineBreaks(value), enabledEntityTypes: [.allUrl, .mention, .hashtag], multiline: true, sectionId: self.section, action: nil, longTapAction: {
|
return ItemListTextWithLabelItem(presentationData: presentationData, label: text, text: foldMultipleLineBreaks(value), enabledEntityTypes: [.allUrl, .mention, .hashtag], multiline: true, sectionId: self.section, action: nil, longTapAction: {
|
||||||
arguments.displayContextMenu(ChannelInfoEntryTag.about, value)
|
arguments.displayContextMenu(ChannelInfoEntryTag.about, value)
|
||||||
}, linkItemAction: { action, itemLink in
|
}, linkItemAction: { action, itemLink in
|
||||||
arguments.aboutLinkAction(action, itemLink)
|
arguments.aboutLinkAction(action, itemLink)
|
||||||
}, tag: ChannelInfoEntryTag.about)
|
}, tag: ChannelInfoEntryTag.about)
|
||||||
case let .addressName(theme, text, value):
|
case let .addressName(_, text, value):
|
||||||
return ItemListTextWithLabelItem(presentationData: presentationData, label: text, text: "https://t.me/\(value)", textColor: .accent, enabledEntityTypes: [], multiline: false, sectionId: self.section, action: {
|
return ItemListTextWithLabelItem(presentationData: presentationData, label: text, text: "https://t.me/\(value)", textColor: .accent, enabledEntityTypes: [], multiline: false, sectionId: self.section, action: {
|
||||||
arguments.displayAddressNameContextMenu("https://t.me/\(value)")
|
arguments.displayAddressNameContextMenu("https://t.me/\(value)")
|
||||||
}, longTapAction: {
|
}, longTapAction: {
|
||||||
arguments.displayContextMenu(ChannelInfoEntryTag.link, "https://t.me/\(value)")
|
arguments.displayContextMenu(ChannelInfoEntryTag.link, "https://t.me/\(value)")
|
||||||
}, tag: ChannelInfoEntryTag.link)
|
}, tag: ChannelInfoEntryTag.link)
|
||||||
case let .channelPhotoSetup(theme, text):
|
case let .channelPhotoSetup(_, text):
|
||||||
return ItemListActionItem(presentationData: presentationData, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
return ItemListActionItem(presentationData: presentationData, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.changeProfilePhoto()
|
arguments.changeProfilePhoto()
|
||||||
})
|
})
|
||||||
case let .channelTypeSetup(theme, text, value):
|
case let .channelTypeSetup(_, text, value):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openChannelTypeSetup()
|
arguments.openChannelTypeSetup()
|
||||||
})
|
})
|
||||||
case let .discussionGroupSetup(theme, text, value):
|
case let .discussionGroupSetup(_, text, value):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openDiscussionGroupSetup()
|
arguments.openDiscussionGroupSetup()
|
||||||
})
|
})
|
||||||
case let .discussionGroupSetupInfo(theme, text):
|
case let .discussionGroupSetupInfo(_, text):
|
||||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
|
||||||
case let .channelDescriptionSetup(theme, placeholder, value):
|
case let .channelDescriptionSetup(_, placeholder, value):
|
||||||
return ItemListMultilineInputItem(presentationData: presentationData, text: value, placeholder: placeholder, maxLength: ItemListMultilineInputItemTextLimit(value: 255, display: true), sectionId: self.section, style: .plain, textUpdated: { updatedText in
|
return ItemListMultilineInputItem(presentationData: presentationData, text: value, placeholder: placeholder, maxLength: ItemListMultilineInputItemTextLimit(value: 255, display: true), sectionId: self.section, style: .plain, textUpdated: { updatedText in
|
||||||
arguments.updateEditingDescriptionText(updatedText)
|
arguments.updateEditingDescriptionText(updatedText)
|
||||||
})
|
})
|
||||||
case let .admins(theme, text, value):
|
case let .admins(_, text, value):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openAdmins()
|
arguments.openAdmins()
|
||||||
})
|
})
|
||||||
case let .members(theme, text, value):
|
case let .members(_, text, value):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openMembers()
|
arguments.openMembers()
|
||||||
})
|
})
|
||||||
case let .banned(theme, text, value):
|
case let .banned(_, text, value):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openBanned()
|
arguments.openBanned()
|
||||||
})
|
})
|
||||||
case let .signMessages(theme, text, value):
|
case let .signMessages(_, text, value):
|
||||||
return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, sectionId: self.section, style: .plain, updated: { updated in
|
return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, sectionId: self.section, style: .plain, updated: { updated in
|
||||||
arguments.toggleSignatures(updated)
|
arguments.toggleSignatures(updated)
|
||||||
})
|
})
|
||||||
case let .signInfo(theme, text):
|
case let .signInfo(_, text):
|
||||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section, style: .plain)
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section, style: .plain)
|
||||||
case let .sharedMedia(theme, text):
|
case let .sharedMedia(_, text):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: "", sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: "", sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openSharedMedia()
|
arguments.openSharedMedia()
|
||||||
})
|
})
|
||||||
case let .stats(theme, text):
|
case let .stats(_, text):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: "", sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: "", sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openStats()
|
arguments.openStats()
|
||||||
})
|
})
|
||||||
case let .notifications(theme, text, value):
|
case let .notifications(_, text, value):
|
||||||
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(presentationData: presentationData, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.changeNotificationMuteSettings()
|
arguments.changeNotificationMuteSettings()
|
||||||
})
|
})
|
||||||
case let .report(theme, text):
|
case let .report(_, text):
|
||||||
return ItemListActionItem(presentationData: presentationData, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
return ItemListActionItem(presentationData: presentationData, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.reportChannel()
|
arguments.reportChannel()
|
||||||
})
|
})
|
||||||
case let .leave(theme, text):
|
case let .leave(_, text):
|
||||||
return ItemListActionItem(presentationData: presentationData, title: text, kind: .destructive, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
return ItemListActionItem(presentationData: presentationData, title: text, kind: .destructive, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.leaveChannel()
|
arguments.leaveChannel()
|
||||||
})
|
})
|
||||||
case let .deleteChannel(theme, text):
|
case let .deleteChannel(_, text):
|
||||||
return ItemListActionItem(presentationData: presentationData, title: text, kind: .destructive, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
return ItemListActionItem(presentationData: presentationData, title: text, kind: .destructive, alignment: .natural, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.deleteChannel()
|
arguments.deleteChannel()
|
||||||
})
|
})
|
||||||
@ -529,7 +529,7 @@ private func channelInfoEntries(account: Account, presentationData: Presentation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let _ = state.editingState, let adminRights = peer.adminRights {
|
if let _ = state.editingState, let _ = peer.adminRights {
|
||||||
let discussionGroupTitle: String?
|
let discussionGroupTitle: String?
|
||||||
if let cachedData = view.cachedData as? CachedChannelData {
|
if let cachedData = view.cachedData as? CachedChannelData {
|
||||||
if case let .known(maybeLinkedDiscussionPeerId) = cachedData.linkedDiscussionPeerId, let linkedDiscussionPeerId = maybeLinkedDiscussionPeerId, let peer = view.peers[linkedDiscussionPeerId] {
|
if case let .known(maybeLinkedDiscussionPeerId) = cachedData.linkedDiscussionPeerId, let linkedDiscussionPeerId = maybeLinkedDiscussionPeerId, let peer = view.peers[linkedDiscussionPeerId] {
|
||||||
@ -934,23 +934,14 @@ public func channelInfoController(context: AccountContext, peerId: PeerId) -> Vi
|
|||||||
globalNotificationSettings = settings
|
globalNotificationSettings = settings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var canManageChannel = false
|
|
||||||
if let peer = peer as? TelegramChannel {
|
|
||||||
if peer.flags.contains(.isCreator) {
|
|
||||||
canManageChannel = true
|
|
||||||
} else if let adminRights = peer.adminRights {
|
|
||||||
canManageChannel = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var canEditChannel = false
|
var canEditChannel = false
|
||||||
var hasSomethingToEdit = false
|
var hasSomethingToEdit = false
|
||||||
if let peer = view.peers[view.peerId] as? TelegramChannel {
|
if let peer = view.peers[view.peerId] as? TelegramChannel {
|
||||||
canEditChannel = peer.hasPermission(.changeInfo)
|
canEditChannel = peer.hasPermission(.changeInfo)
|
||||||
if canEditChannel {
|
if canEditChannel {
|
||||||
hasSomethingToEdit = true
|
hasSomethingToEdit = true
|
||||||
} else if let adminRights = peer.adminRights {
|
} else if let _ = peer.adminRights {
|
||||||
if let cachedData = view.cachedData as? CachedChannelData, case let .known(maybeLinkedDiscussionPeerId) = cachedData.linkedDiscussionPeerId, let _ = maybeLinkedDiscussionPeerId {
|
if let cachedData = view.cachedData as? CachedChannelData, case let .known(maybeLinkedDiscussionPeerId) = cachedData.linkedDiscussionPeerId, let _ = maybeLinkedDiscussionPeerId {
|
||||||
hasSomethingToEdit = true
|
hasSomethingToEdit = true
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ private enum GroupStickerPackEntry: ItemListNodeEntry {
|
|||||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||||
let arguments = arguments as! GroupStickerPackSetupControllerArguments
|
let arguments = arguments as! GroupStickerPackSetupControllerArguments
|
||||||
switch self {
|
switch self {
|
||||||
case let .search(theme, strings, prefix, placeholder, value):
|
case let .search(theme, _, prefix, placeholder, value):
|
||||||
return ItemListSingleLineInputItem(presentationData: presentationData, title: NSAttributedString(string: prefix, textColor: theme.list.itemPrimaryTextColor), text: value, placeholder: placeholder, type: .regular(capitalization: false, autocorrection: false), spacing: 0.0, clearType: .always, tag: nil, sectionId: self.section, textUpdated: { value in
|
return ItemListSingleLineInputItem(presentationData: presentationData, title: NSAttributedString(string: prefix, textColor: theme.list.itemPrimaryTextColor), text: value, placeholder: placeholder, type: .regular(capitalization: false, autocorrection: false), spacing: 0.0, clearType: .always, tag: nil, sectionId: self.section, textUpdated: { value in
|
||||||
arguments.updateSearchText(value)
|
arguments.updateSearchText(value)
|
||||||
}, processPaste: { text in
|
}, processPaste: { text in
|
||||||
@ -223,11 +223,11 @@ private enum GroupStickerPackEntry: ItemListNodeEntry {
|
|||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
}, action: {})
|
}, action: {})
|
||||||
case let .searchInfo(theme, text):
|
case let .searchInfo(_, text):
|
||||||
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section, linkAction: nil)
|
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section, linkAction: nil)
|
||||||
case let .packsTitle(theme, text):
|
case let .packsTitle(_, text):
|
||||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||||
case let .pack(_, theme, strings, info, topItem, count, playAnimatedStickers, selected):
|
case let .pack(_, _, _, info, topItem, count, playAnimatedStickers, selected):
|
||||||
return ItemListStickerPackItem(presentationData: presentationData, account: arguments.account, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: selected ? .selection : .none, editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false), enabled: true, playAnimatedStickers: playAnimatedStickers, sectionId: self.section, action: {
|
return ItemListStickerPackItem(presentationData: presentationData, account: arguments.account, packInfo: info, itemCount: count, topItem: topItem, unread: false, control: selected ? .selection : .none, editing: ItemListStickerPackItemEditing(editable: false, editing: false, revealed: false, reorderable: false), enabled: true, playAnimatedStickers: playAnimatedStickers, sectionId: self.section, action: {
|
||||||
if selected {
|
if selected {
|
||||||
arguments.openStickerPack(info)
|
arguments.openStickerPack(info)
|
||||||
|
@ -116,7 +116,7 @@ private final class PeerBanTimeoutActionSheetItemNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.pickerView.frame = CGRect(origin: CGPoint(), size: size)
|
self.pickerView.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ private final class ReportPeerDetailsActionSheetItemNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
let size = CGSize(width: constrainedSize.width, height: inputHeight)
|
let size = CGSize(width: constrainedSize.width, height: inputHeight)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ private final class ReportPeerHeaderActionSheetItemNode: ActionSheetItemNode {
|
|||||||
let size = CGSize(width: constrainedSize.width, height: topInset + iconSize.height + textSpacing + textSize.height + bottomInset)
|
let size = CGSize(width: constrainedSize.width, height: topInset + iconSize.height + textSpacing + textSize.height + bottomInset)
|
||||||
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
self.accessibilityArea.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ private final class ProxyServerInfoItemNode: ActionSheetItemNode {
|
|||||||
offset += 36.0
|
offset += 36.0
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ private final class ProxyServerActionItemNode: ActionSheetItemNode {
|
|||||||
self.titleNode.frame = titleFrame
|
self.titleNode.frame = titleFrame
|
||||||
self.activityIndicator.frame = CGRect(origin: CGPoint(x: 14.0, y: titleFrame.minY - 0.0), size: activitySize)
|
self.activityIndicator.frame = CGRect(origin: CGPoint(x: 14.0, y: titleFrame.minY - 0.0), size: activitySize)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ private final class ThemeAutoNightTimeSelectionActionSheetItemNode: ActionSheetI
|
|||||||
|
|
||||||
self.pickerView.frame = CGRect(origin: CGPoint(), size: size)
|
self.pickerView.frame = CGRect(origin: CGPoint(), size: size)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ public struct PixelDimensions: Equatable {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
|
|
||||||
public extension PixelDimensions {
|
public extension PixelDimensions {
|
||||||
public init(_ size: CGSize) {
|
init(_ size: CGSize) {
|
||||||
self.init(width: Int32(size.width), height: Int32(size.height))
|
self.init(width: Int32(size.width), height: Int32(size.height))
|
||||||
}
|
}
|
||||||
|
|
||||||
public var cgSize: CGSize {
|
var cgSize: CGSize {
|
||||||
return CGSize(width: CGFloat(self.width), height: CGFloat(self.height))
|
return CGSize(width: CGFloat(self.width), height: CGFloat(self.height))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ public class LocationBroadcastActionSheetItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,8 +109,6 @@ public class LocationBroadcastActionSheetItemNode: ActionSheetItemNode {
|
|||||||
self.avatarNode.setPeer(context: item.context, theme: (item.context.sharedContext.currentPresentationData.with { $0 }).theme, peer: item.peer)
|
self.avatarNode.setPeer(context: item.context, theme: (item.context.sharedContext.currentPresentationData.with { $0 }).theme, peer: item.peer)
|
||||||
|
|
||||||
self.timerNode.update(backgroundColor: self.theme.controlAccentColor.withAlphaComponent(0.4), foregroundColor: self.theme.controlAccentColor, textColor: self.theme.controlAccentColor, beginTimestamp: item.beginTimestamp, timeout: item.timeout, strings: item.strings)
|
self.timerNode.update(backgroundColor: self.theme.controlAccentColor.withAlphaComponent(0.4), foregroundColor: self.theme.controlAccentColor, textColor: self.theme.controlAccentColor, beginTimestamp: item.beginTimestamp, timeout: item.timeout, strings: item.strings)
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -128,7 +127,7 @@ public class LocationBroadcastActionSheetItemNode: ActionSheetItemNode {
|
|||||||
let timerSize = CGSize(width: 28.0, height: 28.0)
|
let timerSize = CGSize(width: 28.0, height: 28.0)
|
||||||
self.timerNode.frame = CGRect(origin: CGPoint(x: size.width - 16.0 - timerSize.width, y: floorToScreenPixels((size.height - timerSize.height) / 2.0)), size: timerSize)
|
self.timerNode.frame = CGRect(origin: CGPoint(x: size.width - 16.0 - timerSize.width, y: floorToScreenPixels((size.height - timerSize.height) / 2.0)), size: timerSize)
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ public class CallRouteActionSheetItem: ActionSheetItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.setItem(self)
|
node.setItem(self)
|
||||||
|
node.requestLayoutUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,8 +133,6 @@ public class CallRouteActionSheetItemNode: ActionSheetItemNode {
|
|||||||
}
|
}
|
||||||
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
self.accessibilityArea.accessibilityTraits = accessibilityTraits
|
||||||
self.accessibilityArea.accessibilityLabel = item.title
|
self.accessibilityArea.accessibilityLabel = item.title
|
||||||
|
|
||||||
self.setNeedsLayout()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
public override func updateLayout(constrainedSize: CGSize, transition: ContainedViewLayoutTransition) -> CGSize {
|
||||||
@ -152,7 +151,7 @@ public class CallRouteActionSheetItemNode: ActionSheetItemNode {
|
|||||||
self.checkNode.frame = CGRect(origin: CGPoint(x: size.width - image.size.width - 13.0, y: floor((size.height - image.size.height) / 2.0)), size: image.size)
|
self.checkNode.frame = CGRect(origin: CGPoint(x: size.width - image.size.width - 13.0, y: floor((size.height - image.size.height) / 2.0)), size: image.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import SwiftSignalKit
|
|||||||
|
|
||||||
public func forwardGameWithScore(account: Account, messageId: MessageId, to peerId: PeerId) -> Signal<Void, NoError> {
|
public func forwardGameWithScore(account: Account, messageId: MessageId, to peerId: PeerId) -> Signal<Void, NoError> {
|
||||||
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||||
if let message = transaction.getMessage(messageId), let fromPeer = transaction.getPeer(messageId.peerId), let fromInputPeer = apiInputPeer(fromPeer), let toPeer = transaction.getPeer(peerId), let toInputPeer = apiInputPeer(toPeer) {
|
if let _ = transaction.getMessage(messageId), let fromPeer = transaction.getPeer(messageId.peerId), let fromInputPeer = apiInputPeer(fromPeer), let toPeer = transaction.getPeer(peerId), let toInputPeer = apiInputPeer(toPeer) {
|
||||||
return account.network.request(Api.functions.messages.forwardMessages(flags: 1 << 8, fromPeer: fromInputPeer, id: [messageId.id], randomId: [arc4random64()], toPeer: toInputPeer, scheduleDate: nil))
|
return account.network.request(Api.functions.messages.forwardMessages(flags: 1 << 8, fromPeer: fromInputPeer, id: [messageId.id], randomId: [arc4random64()], toPeer: toInputPeer, scheduleDate: nil))
|
||||||
|> map(Optional.init)
|
|> map(Optional.init)
|
||||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||||
|
@ -79,7 +79,7 @@ extension InstantPageTableRow {
|
|||||||
extension InstantPageRelatedArticle {
|
extension InstantPageRelatedArticle {
|
||||||
convenience init(apiRelatedArticle: Api.PageRelatedArticle) {
|
convenience init(apiRelatedArticle: Api.PageRelatedArticle) {
|
||||||
switch apiRelatedArticle {
|
switch apiRelatedArticle {
|
||||||
case let .pageRelatedArticle(flags, url, webpageId, title, description, photoId, author, publishedDate):
|
case let .pageRelatedArticle(_, url, webpageId, title, description, photoId, author, publishedDate):
|
||||||
var posterPhotoId: MediaId?
|
var posterPhotoId: MediaId?
|
||||||
if let photoId = photoId {
|
if let photoId = photoId {
|
||||||
posterPhotoId = MediaId(namespace: Namespaces.Media.CloudImage, id: photoId)
|
posterPhotoId = MediaId(namespace: Namespaces.Media.CloudImage, id: photoId)
|
||||||
@ -177,14 +177,14 @@ extension InstantPage {
|
|||||||
let url: String
|
let url: String
|
||||||
let views: Int32?
|
let views: Int32?
|
||||||
switch apiPage {
|
switch apiPage {
|
||||||
case let .page(page):
|
case let .page(flags, pageUrl, pageBlocks, pagePhotos, pageDocuments, pageViews):
|
||||||
url = page.url
|
url = pageUrl
|
||||||
blocks = page.blocks
|
blocks = pageBlocks
|
||||||
photos = page.photos
|
photos = pagePhotos
|
||||||
files = page.documents
|
files = pageDocuments
|
||||||
isComplete = (page.flags & (1 << 0)) == 0
|
isComplete = (flags & (1 << 0)) == 0
|
||||||
rtl = (page.flags & (1 << 1)) != 0
|
rtl = (flags & (1 << 1)) != 0
|
||||||
views = page.views
|
views = pageViews
|
||||||
}
|
}
|
||||||
var media: [MediaId: Media] = [:]
|
var media: [MediaId: Media] = [:]
|
||||||
for photo in photos {
|
for photo in photos {
|
||||||
|
@ -584,8 +584,6 @@ private func decryptedAttributes73(_ attributes: [TelegramMediaFileAttribute], t
|
|||||||
break
|
break
|
||||||
case .hintIsValidated:
|
case .hintIsValidated:
|
||||||
break
|
break
|
||||||
case .hintIsValidated:
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -99,7 +99,7 @@ public func preloadedFeaturedStickerSet(network: Network, postbox: Postbox, id:
|
|||||||
if let result = result {
|
if let result = result {
|
||||||
return postbox.transaction { transaction -> Void in
|
return postbox.transaction { transaction -> Void in
|
||||||
if let pack = transaction.getOrderedItemListItem(collectionId: Namespaces.OrderedItemList.CloudFeaturedStickerPacks, itemId: FeaturedStickerPackItemId(id.id).rawValue)?.contents as? FeaturedStickerPackItem {
|
if let pack = transaction.getOrderedItemListItem(collectionId: Namespaces.OrderedItemList.CloudFeaturedStickerPacks, itemId: FeaturedStickerPackItemId(id.id).rawValue)?.contents as? FeaturedStickerPackItem {
|
||||||
var items = result.items.map({ $0 as? StickerPackItem }).flatMap({ $0 })
|
var items = result.items.map({ $0 as? StickerPackItem }).compactMap({ $0 })
|
||||||
if items.count > 5 {
|
if items.count > 5 {
|
||||||
items.removeSubrange(5 ..< items.count)
|
items.removeSubrange(5 ..< items.count)
|
||||||
}
|
}
|
||||||
|
@ -88,10 +88,10 @@ public func stickerPacksAttachedToMedia(account: Account, media: AnyMediaReferen
|
|||||||
|> mapToSignal { reference -> Signal<[Api.StickerSetCovered], MTRpcError> in
|
|> mapToSignal { reference -> Signal<[Api.StickerSetCovered], MTRpcError> in
|
||||||
let inputMedia: Api.InputStickeredMedia
|
let inputMedia: Api.InputStickeredMedia
|
||||||
if let resource = reference.updatedResource as? TelegramCloudMediaResourceWithFileReference, let updatedReference = resource.fileReference {
|
if let resource = reference.updatedResource as? TelegramCloudMediaResourceWithFileReference, let updatedReference = resource.fileReference {
|
||||||
if let imageReference = media.concrete(TelegramMediaImage.self), let reference = imageReference.media.reference, case let .cloud(imageId, accessHash, fileReference) = reference, let representation = largestImageRepresentation(imageReference.media.representations) {
|
if let imageReference = media.concrete(TelegramMediaImage.self), let reference = imageReference.media.reference, case let .cloud(imageId, accessHash, _) = reference, let representation = largestImageRepresentation(imageReference.media.representations) {
|
||||||
inputMedia = .inputStickeredMediaPhoto(id: Api.InputPhoto.inputPhoto(id: imageId, accessHash: accessHash, fileReference: Buffer(data: updatedReference ?? Data())))
|
inputMedia = .inputStickeredMediaPhoto(id: Api.InputPhoto.inputPhoto(id: imageId, accessHash: accessHash, fileReference: Buffer(data: updatedReference)))
|
||||||
} else if let fileReference = media.concrete(TelegramMediaFile.self), let resource = fileReference.media.resource as? CloudDocumentMediaResource {
|
} else if let fileReference = media.concrete(TelegramMediaFile.self), let resource = fileReference.media.resource as? CloudDocumentMediaResource {
|
||||||
inputMedia = .inputStickeredMediaDocument(id: Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: updatedReference ?? Data())))
|
inputMedia = .inputStickeredMediaDocument(id: Api.InputDocument.inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: updatedReference)))
|
||||||
} else {
|
} else {
|
||||||
return .single([])
|
return .single([])
|
||||||
}
|
}
|
||||||
|
@ -120,13 +120,13 @@ func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
|
|||||||
case let .message(message):
|
case let .message(message):
|
||||||
let chatPeerId = message.peerId
|
let chatPeerId = message.peerId
|
||||||
return chatPeerId.peerId
|
return chatPeerId.peerId
|
||||||
case let .messageEmpty(_, id, peerId):
|
case let .messageEmpty(_, _, peerId):
|
||||||
if let peerId = peerId {
|
if let peerId = peerId {
|
||||||
return peerId.peerId
|
return peerId.peerId
|
||||||
} else {
|
} else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
case let .messageService(flags, _, fromId, chatPeerId, _, _, _, _):
|
case let .messageService(_, _, _, chatPeerId, _, _, _, _):
|
||||||
return chatPeerId.peerId
|
return chatPeerId.peerId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
return result
|
return result
|
||||||
case .messageEmpty:
|
case .messageEmpty:
|
||||||
return []
|
return []
|
||||||
case let .messageService(flags, _, fromId, chatPeerId, _, _, action, _):
|
case let .messageService(_, _, fromId, chatPeerId, _, _, action, _):
|
||||||
let peerId: PeerId = chatPeerId.peerId
|
let peerId: PeerId = chatPeerId.peerId
|
||||||
var result = [peerId]
|
var result = [peerId]
|
||||||
|
|
||||||
|
@ -54,9 +54,8 @@ public func deviceContactsImportedByCount(postbox: Postbox, contacts: [(String,
|
|||||||
for (id, numbers) in contacts {
|
for (id, numbers) in contacts {
|
||||||
var maxCount: Int32 = 0
|
var maxCount: Int32 = 0
|
||||||
for number in numbers {
|
for number in numbers {
|
||||||
if let value = transaction.getDeviceContactImportInfo(TelegramDeviceContactImportIdentifier.phoneNumber(number).key) as? TelegramDeviceContactImportedData, case let .imported(imported) = value {
|
if let value = transaction.getDeviceContactImportInfo(TelegramDeviceContactImportIdentifier.phoneNumber(number).key) as? TelegramDeviceContactImportedData, case let .imported(_, importedByCount) = value {
|
||||||
|
maxCount = max(maxCount, importedByCount)
|
||||||
maxCount = max(maxCount, imported.importedByCount)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if maxCount != 0 {
|
if maxCount != 0 {
|
||||||
|
@ -7,8 +7,8 @@ import SyncCore
|
|||||||
extension TelegramMediaWebFile {
|
extension TelegramMediaWebFile {
|
||||||
convenience init(_ document: Api.WebDocument) {
|
convenience init(_ document: Api.WebDocument) {
|
||||||
switch document {
|
switch document {
|
||||||
case let .webDocument(data):
|
case let .webDocument(url, accessHash, size, mimeType, attributes):
|
||||||
self.init(resource: WebFileReferenceMediaResource(url: data.url, size: data.size, accessHash: data.accessHash), mimeType: data.mimeType, size: data.size, attributes: telegramMediaFileAttributesFromApiAttributes(data.attributes))
|
self.init(resource: WebFileReferenceMediaResource(url: url, size: size, accessHash: accessHash), mimeType: mimeType, size: size, attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
|
||||||
case let .webDocumentNoProxy(url, size, mimeType, attributes):
|
case let .webDocumentNoProxy(url, size, mimeType, attributes):
|
||||||
self.init(resource: HttpReferenceMediaResource(url: url, size: Int(size)), mimeType: mimeType, size: size, attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
|
self.init(resource: HttpReferenceMediaResource(url: url, size: Int(size)), mimeType: mimeType, size: size, attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import SyncCore
|
|||||||
|
|
||||||
func telegramMediaWebpageAttributeFromApiWebpageAttribute(_ attribute: Api.WebPageAttribute) -> TelegramMediaWebpageAttribute? {
|
func telegramMediaWebpageAttributeFromApiWebpageAttribute(_ attribute: Api.WebPageAttribute) -> TelegramMediaWebpageAttribute? {
|
||||||
switch attribute {
|
switch attribute {
|
||||||
case let .webPageAttributeTheme(flags, documents, settings):
|
case let .webPageAttributeTheme(_, documents, settings):
|
||||||
var files: [TelegramMediaFile] = []
|
var files: [TelegramMediaFile] = []
|
||||||
if let documents = documents {
|
if let documents = documents {
|
||||||
files = documents.compactMap { telegramMediaFileFromApiDocument($0) }
|
files = documents.compactMap { telegramMediaFileFromApiDocument($0) }
|
||||||
|
@ -59,7 +59,7 @@ func managedTermsOfServiceUpdates(postbox: Postbox, network: Network, stateManag
|
|||||||
switch result {
|
switch result {
|
||||||
case let .termsOfServiceUpdate(_, termsOfService):
|
case let .termsOfServiceUpdate(_, termsOfService):
|
||||||
updated = TermsOfServiceUpdate(apiTermsOfService: termsOfService)
|
updated = TermsOfServiceUpdate(apiTermsOfService: termsOfService)
|
||||||
case let .termsOfServiceUpdateEmpty(expires):
|
case .termsOfServiceUpdateEmpty:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
stateManager?.modifyTermsOfServiceUpdate { _ in
|
stateManager?.modifyTermsOfServiceUpdate { _ in
|
||||||
|
@ -10,8 +10,6 @@ extension TelegramTheme {
|
|||||||
switch apiTheme {
|
switch apiTheme {
|
||||||
case let .theme(flags, id, accessHash, slug, title, document, settings, installCount):
|
case let .theme(flags, id, accessHash, slug, title, document, settings, installCount):
|
||||||
self.init(id: id, accessHash: accessHash, slug: slug, title: title, file: document.flatMap(telegramMediaFileFromApiDocument), settings: settings.flatMap(TelegramThemeSettings.init(apiThemeSettings:)), isCreator: (flags & 1 << 0) != 0, isDefault: (flags & 1 << 1) != 0, installCount: installCount)
|
self.init(id: id, accessHash: accessHash, slug: slug, title: title, file: document.flatMap(telegramMediaFileFromApiDocument), settings: settings.flatMap(TelegramThemeSettings.init(apiThemeSettings:)), isCreator: (flags & 1 << 0) != 0, isDefault: (flags & 1 << 1) != 0, installCount: installCount)
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,14 +47,12 @@ extension TelegramBaseTheme {
|
|||||||
extension TelegramThemeSettings {
|
extension TelegramThemeSettings {
|
||||||
convenience init?(apiThemeSettings: Api.ThemeSettings) {
|
convenience init?(apiThemeSettings: Api.ThemeSettings) {
|
||||||
switch apiThemeSettings {
|
switch apiThemeSettings {
|
||||||
case let .themeSettings(flags, baseTheme, accentColor, messageTopColor, messageBottomColor, wallpaper):
|
case let .themeSettings(_, baseTheme, accentColor, messageTopColor, messageBottomColor, wallpaper):
|
||||||
var messageColors: (UInt32, UInt32)?
|
var messageColors: (UInt32, UInt32)?
|
||||||
if let messageTopColor = messageTopColor, let messageBottomColor = messageBottomColor {
|
if let messageTopColor = messageTopColor, let messageBottomColor = messageBottomColor {
|
||||||
messageColors = (UInt32(bitPattern: messageTopColor), UInt32(bitPattern: messageBottomColor))
|
messageColors = (UInt32(bitPattern: messageTopColor), UInt32(bitPattern: messageBottomColor))
|
||||||
}
|
}
|
||||||
self.init(baseTheme: TelegramBaseTheme(apiBaseTheme: baseTheme) ?? .classic, accentColor: UInt32(bitPattern: accentColor), messageColors: messageColors, wallpaper: wallpaper.flatMap(TelegramWallpaper.init(apiWallpaper:)))
|
self.init(baseTheme: TelegramBaseTheme(apiBaseTheme: baseTheme), accentColor: UInt32(bitPattern: accentColor), messageColors: messageColors, wallpaper: wallpaper.flatMap(TelegramWallpaper.init(apiWallpaper:)))
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ private final class ChatDateSelectorItemNode: ActionSheetItemNode {
|
|||||||
|
|
||||||
self.pickerView.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 180.0))
|
self.pickerView.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 180.0))
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,7 +590,7 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
|
|||||||
f(.default)
|
f(.default)
|
||||||
})))
|
})))
|
||||||
|
|
||||||
if isSpeakSelectionEnabled() {
|
if isSpeakSelectionEnabled() && !message.text.isEmpty {
|
||||||
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSpeak, icon: { theme in
|
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSpeak, icon: { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Message"), color: theme.actionSheet.primaryTextColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Message"), color: theme.actionSheet.primaryTextColor)
|
||||||
}, action: { _, f in
|
}, action: { _, f in
|
||||||
|
@ -179,7 +179,7 @@ private final class AutoremoveTimeoutSelectorItemNode: ActionSheetItemNode, UIPi
|
|||||||
|
|
||||||
self.pickerView.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 180.0))
|
self.pickerView.frame = CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: 180.0))
|
||||||
|
|
||||||
self.updateInternalLayout(size)
|
self.updateInternalLayout(size, constrainedSize: constrainedSize)
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user