mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit '6490f0ba067afe2e407a931f82e8a5de8fc19fd5'
This commit is contained in:
commit
87890295be
@ -6872,6 +6872,7 @@ Sorry for the inconvenience.";
|
||||
"InviteLink.Create.RequestApprovalOnInfoGroup" = "New users will be able to join the group only after having been approved by the admins.";
|
||||
"InviteLink.Create.RequestApprovalOnInfoChannel" = "New users will be able to join the channel only after having been approved by the admins.";
|
||||
|
||||
"InviteLink.Create.LinkNameTitle" = "Link Name";
|
||||
"InviteLink.Create.LinkName" = "Link Name (Optional)";
|
||||
"InviteLink.Create.LinkNameInfo" = "Only you and other admins will see this name.";
|
||||
|
||||
|
@ -357,7 +357,7 @@ class CallListCallItemNode: ItemListRevealOptionsItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
var dateRightInset: CGFloat = 46.0 + params.rightInset
|
||||
|
@ -309,7 +309,7 @@ class CallListGroupCallItemNode: ItemListRevealOptionsItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
var dateRightInset: CGFloat = 46.0 + params.rightInset
|
||||
|
@ -140,7 +140,7 @@ class ChatListFilterSettingsHeaderItemNode: ListViewItemNode {
|
||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: attributedText, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: params.width - params.rightInset - leftInset * 2.0, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: topInset + titleLayout.size.height)
|
||||
var insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
var insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
if isHidden {
|
||||
insets = UIEdgeInsets()
|
||||
|
@ -201,7 +201,7 @@ class ChatListFilterPresetCategoryItemNode: ItemListRevealOptionsItemNode, ItemL
|
||||
|
||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let minHeight: CGFloat = titleLayout.size.height + verticalInset * 2.0
|
||||
let rawHeight: CGFloat = verticalInset * 2.0 + titleLayout.size.height
|
||||
|
@ -226,7 +226,7 @@ private final class ChatListFilterPresetListItemNode: ItemListRevealOptionsItemN
|
||||
let labelConstrain: CGFloat = params.width - params.rightInset - leftInset - 40.0 - titleLayout.size.width - 10.0
|
||||
let (labelLayout, labelApply) = makeLabelLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.label, font: titleFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: labelConstrain, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: titleLayout.size.height + 11.0 * 2.0)
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
|
@ -226,7 +226,7 @@ public class ChatListFilterPresetListSuggestedItemNode: ListViewItemNode, ItemLi
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: height)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -140,7 +140,7 @@ class CreatePollOptionActionItemNode: ListViewItemNode, ItemListItemNode {
|
||||
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: 44.0)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -261,7 +261,7 @@ class CreatePollOptionItemNode: ItemListRevealOptionsItemNode, ItemListItemNode,
|
||||
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let leftInset: CGFloat = params.leftInset + (item.isSelected != nil ? 60.0 : 16.0)
|
||||
let rightInset: CGFloat = 44.0 + params.rightInset
|
||||
|
@ -336,7 +336,7 @@ public class CreatePollTextInputItemNode: ListViewItemNode, ASEditableTextNodeDe
|
||||
}
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: contentHeight)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -70,6 +70,7 @@ func isValidNumberOfUsers(_ number: String) -> Bool {
|
||||
}
|
||||
|
||||
private enum InviteLinksEditEntry: ItemListNodeEntry {
|
||||
case titleHeader(PresentationTheme, String)
|
||||
case title(PresentationTheme, String, String)
|
||||
case titleInfo(PresentationTheme, String)
|
||||
|
||||
@ -91,7 +92,7 @@ private enum InviteLinksEditEntry: ItemListNodeEntry {
|
||||
|
||||
var section: ItemListSectionId {
|
||||
switch self {
|
||||
case .title, .titleInfo:
|
||||
case .titleHeader, .title, .titleInfo:
|
||||
return InviteLinksEditSection.title.rawValue
|
||||
case .requestApproval, .requestApprovalInfo:
|
||||
return InviteLinksEditSection.requestApproval.rawValue
|
||||
@ -106,39 +107,47 @@ private enum InviteLinksEditEntry: ItemListNodeEntry {
|
||||
|
||||
var stableId: Int32 {
|
||||
switch self {
|
||||
case .title:
|
||||
case .titleHeader:
|
||||
return 0
|
||||
case .titleInfo:
|
||||
case .title:
|
||||
return 1
|
||||
case .requestApproval:
|
||||
case .titleInfo:
|
||||
return 2
|
||||
case .requestApprovalInfo:
|
||||
case .requestApproval:
|
||||
return 3
|
||||
case .timeHeader:
|
||||
case .requestApprovalInfo:
|
||||
return 4
|
||||
case .timePicker:
|
||||
case .timeHeader:
|
||||
return 5
|
||||
case .timeExpiryDate:
|
||||
case .timePicker:
|
||||
return 6
|
||||
case .timeCustomPicker:
|
||||
case .timeExpiryDate:
|
||||
return 7
|
||||
case .timeInfo:
|
||||
case .timeCustomPicker:
|
||||
return 8
|
||||
case .usageHeader:
|
||||
case .timeInfo:
|
||||
return 9
|
||||
case .usagePicker:
|
||||
case .usageHeader:
|
||||
return 10
|
||||
case .usageCustomPicker:
|
||||
case .usagePicker:
|
||||
return 11
|
||||
case .usageInfo:
|
||||
case .usageCustomPicker:
|
||||
return 12
|
||||
case .revoke:
|
||||
case .usageInfo:
|
||||
return 13
|
||||
case .revoke:
|
||||
return 14
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: InviteLinksEditEntry, rhs: InviteLinksEditEntry) -> Bool {
|
||||
switch lhs {
|
||||
case let .titleHeader(lhsTheme, lhsText):
|
||||
if case let .titleHeader(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .title(lhsTheme, lhsPlaceholder, lhsValue):
|
||||
if case let .title(rhsTheme, rhsPlaceholder, rhsValue) = rhs, lhsTheme === rhsTheme, lhsPlaceholder == rhsPlaceholder, lhsValue == rhsValue {
|
||||
return true
|
||||
@ -233,6 +242,8 @@ private enum InviteLinksEditEntry: ItemListNodeEntry {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! InviteLinkEditControllerArguments
|
||||
switch self {
|
||||
case let .titleHeader(_, text):
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||
case let .title(_, placeholder, value):
|
||||
return ItemListSingleLineInputItem(presentationData: presentationData, title: NSAttributedString(), text: value, placeholder: placeholder, maxLength: 32, sectionId: self.section, textUpdated: { value in
|
||||
arguments.updateState { state in
|
||||
@ -356,6 +367,7 @@ private enum InviteLinksEditEntry: ItemListNodeEntry {
|
||||
private func inviteLinkEditControllerEntries(invite: ExportedInvitation?, state: InviteLinkEditControllerState, isGroup: Bool, isPublic: Bool, presentationData: PresentationData) -> [InviteLinksEditEntry] {
|
||||
var entries: [InviteLinksEditEntry] = []
|
||||
|
||||
entries.append(.titleHeader(presentationData.theme, presentationData.strings.InviteLink_Create_LinkNameTitle.uppercased()))
|
||||
entries.append(.title(presentationData.theme, presentationData.strings.InviteLink_Create_LinkName, state.title))
|
||||
entries.append(.titleInfo(presentationData.theme, presentationData.strings.InviteLink_Create_LinkNameInfo))
|
||||
|
||||
|
@ -112,7 +112,7 @@ class InviteLinkHeaderItemNode: ListViewItemNode {
|
||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: attributedText, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: params.width - params.rightInset - leftInset * 2.0, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: topInset + titleLayout.size.height)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
||||
|
@ -166,6 +166,10 @@ public func inviteRequestsController(context: AccountContext, updatedPresentatio
|
||||
|
||||
let actionsDisposable = DisposableSet()
|
||||
|
||||
if let existingContext = existingContext {
|
||||
existingContext.reload()
|
||||
}
|
||||
|
||||
let statePromise = ValuePromise(InviteRequestsControllerState(searchingMembers: false), ignoreRepeated: true)
|
||||
let stateValue = Atomic(value: InviteRequestsControllerState(searchingMembers: false))
|
||||
let updateState: ((InviteRequestsControllerState) -> InviteRequestsControllerState) -> Void = { f in
|
||||
|
@ -236,17 +236,18 @@ private final class InviteRequestsSearchContainerInteraction {
|
||||
}
|
||||
|
||||
private enum InviteRequestsSearchEntryId: Hashable {
|
||||
case placeholder(Int)
|
||||
case request(EnginePeer.Id)
|
||||
}
|
||||
|
||||
private final class InviteRequestsSearchEntry: Comparable, Identifiable {
|
||||
let index: Int
|
||||
let request: PeerInvitationImportersState.Importer
|
||||
let request: PeerInvitationImportersState.Importer?
|
||||
let dateTimeFormat: PresentationDateTimeFormat
|
||||
let nameDisplayOrder: PresentationPersonNameOrder
|
||||
let isGroup: Bool
|
||||
|
||||
init(index: Int, request: PeerInvitationImportersState.Importer, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, isGroup: Bool) {
|
||||
init(index: Int, request: PeerInvitationImportersState.Importer?, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder, isGroup: Bool) {
|
||||
self.index = index
|
||||
self.request = request
|
||||
self.dateTimeFormat = dateTimeFormat
|
||||
@ -255,7 +256,11 @@ private final class InviteRequestsSearchEntry: Comparable, Identifiable {
|
||||
}
|
||||
|
||||
var stableId: InviteRequestsSearchEntryId {
|
||||
return .request(self.request.peer.peerId)
|
||||
if let request = self.request {
|
||||
return .request(request.peer.peerId)
|
||||
} else {
|
||||
return .placeholder(self.index)
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: InviteRequestsSearchEntry, rhs: InviteRequestsSearchEntry) -> Bool {
|
||||
@ -268,19 +273,19 @@ private final class InviteRequestsSearchEntry: Comparable, Identifiable {
|
||||
|
||||
func item(context: AccountContext, presentationData: PresentationData, nameSortOrder: PresentationPersonNameOrder, nameDisplayOrder: PresentationPersonNameOrder, interaction: InviteRequestsSearchContainerInteraction) -> ListViewItem {
|
||||
return ItemListInviteRequestItem(context: context, presentationData: ItemListPresentationData(presentationData), dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, importer: self.request, isGroup: self.isGroup, sectionId: 0, style: .plain, tapAction: {
|
||||
if let peer = self.request.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
if let peer = self.request?.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
interaction.openPeer(peer)
|
||||
}
|
||||
}, addAction: {
|
||||
if let peer = self.request.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
if let peer = self.request?.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
interaction.approveRequest(peer)
|
||||
}
|
||||
}, dismissAction: {
|
||||
if let peer = self.request.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
if let peer = self.request?.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
interaction.denyRequest(peer)
|
||||
}
|
||||
}, contextAction: { node, gesture in
|
||||
if let peer = self.request.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
if let peer = self.request?.peer.peer.flatMap({ EnginePeer($0) }) {
|
||||
interaction.peerContextAction(peer, node, gesture)
|
||||
}
|
||||
})
|
||||
@ -489,12 +494,16 @@ public final class InviteRequestsSearchContainerNode: SearchDisplayControllerCon
|
||||
|
||||
return combineLatest(requestsContext.state, presentationDataPromise.get(), processedPeerIds.get())
|
||||
|> mapToSignal { state, presentationData, processedPeerIds -> Signal<[InviteRequestsSearchEntry]?, NoError> in
|
||||
if !state.hasLoadedOnce {
|
||||
return .complete()
|
||||
}
|
||||
|
||||
var entries: [InviteRequestsSearchEntry] = []
|
||||
var index = 0
|
||||
if !state.hasLoadedOnce {
|
||||
for _ in 0 ..< 2 {
|
||||
entries.append(InviteRequestsSearchEntry(index: index, request: nil, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, isGroup: isGroup))
|
||||
index += 1
|
||||
}
|
||||
return .single(entries)
|
||||
}
|
||||
|
||||
for importer in state.importers {
|
||||
if processedPeerIds.contains(importer.peer.peerId) {
|
||||
continue
|
||||
|
@ -138,7 +138,7 @@ public class ItemListDatePickerItemNode: ListViewItemNode, ItemListItemNode {
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: height)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
return (ListViewItemNodeLayout(contentSize: contentSize, insets: insets), { [weak self] in
|
||||
|
@ -275,7 +275,7 @@ private final class ItemListInviteLinkTimeLimitItemNode: ListViewItemNode {
|
||||
let (customTextLayout, customTextApply) = makeCustomTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: customTextString, font: Font.regular(13.0), textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: CGFloat.greatestFiniteMagnitude), alignment: .center, lineSpacing: 0.0, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -456,7 +456,7 @@ public class ItemListInviteLinkItemNode: ListViewItemNode, ItemListItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: max(minHeight, rawHeight))
|
||||
|
@ -285,7 +285,7 @@ private final class ItemListInviteLinkUsageLimitItemNode: ListViewItemNode {
|
||||
let (customTextLayout, customTextApply) = makeCustomTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: customTextString, font: Font.regular(13.0), textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: CGFloat.greatestFiniteMagnitude), alignment: .center, lineSpacing: 0.0, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -245,6 +245,16 @@ public class ItemListInviteRequestItemNode: ListViewItemNode, ItemListItemNode {
|
||||
}
|
||||
self.dismissButton.addTarget(self, action: #selector(self.dismissPressed), forControlEvents: .touchUpInside)
|
||||
|
||||
self.containerNode.shouldBegin = { [weak self] point in
|
||||
guard let strongSelf = self, let item = strongSelf.layoutParams?.0 else {
|
||||
return false
|
||||
}
|
||||
if item.importer == nil || strongSelf.addButton.frame.contains(point) || strongSelf.dismissButton.frame.contains(point) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
self.containerNode.activated = { [weak self] gesture, _ in
|
||||
guard let strongSelf = self, let item = strongSelf.layoutParams?.0, let _ = item.importer, let contextAction = item.contextAction else {
|
||||
gesture.cancel()
|
||||
@ -559,7 +569,7 @@ public class ItemListInviteRequestItemNode: ListViewItemNode, ItemListItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: max(minHeight, rawHeight))
|
||||
@ -732,8 +742,9 @@ public class ItemListInviteRequestItemNode: ListViewItemNode, ItemListItemNode {
|
||||
|
||||
var shapes: [ShimmerEffectNode.Shape] = []
|
||||
|
||||
let titleLineWidth: CGFloat = 180.0
|
||||
let subtitleLineWidth: CGFloat = 60.0
|
||||
let titleLineWidth: CGFloat = 120.0
|
||||
let subtitleLineWidth: CGFloat = 180.0
|
||||
let dateLineWidth: CGFloat = 35.0
|
||||
let lineDiameter: CGFloat = 10.0
|
||||
|
||||
let iconFrame = strongSelf.avatarNode.frame
|
||||
@ -745,6 +756,15 @@ public class ItemListInviteRequestItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let subtitleFrame = strongSelf.subtitleNode.frame
|
||||
shapes.append(.roundedRectLine(startPoint: CGPoint(x: subtitleFrame.minX, y: subtitleFrame.minY + floor((subtitleFrame.height - lineDiameter) / 2.0)), width: subtitleLineWidth, diameter: lineDiameter))
|
||||
|
||||
let dateFrame = strongSelf.dateNode.frame
|
||||
shapes.append(.roundedRectLine(startPoint: CGPoint(x: dateFrame.maxX - dateLineWidth, y: dateFrame.minY + floor((dateFrame.height - lineDiameter) / 2.0)), width: dateLineWidth, diameter: lineDiameter))
|
||||
|
||||
let addFrame = strongSelf.addButton.frame
|
||||
shapes.append(.roundedRectLine(startPoint: CGPoint(x: addFrame.minX, y: addFrame.minY + floor((addFrame.height - strongSelf.addButton.frame.height) / 2.0)), width: strongSelf.addButton.frame.width, diameter: strongSelf.addButton.frame.height))
|
||||
|
||||
let dismissFrame = strongSelf.dismissButton.frame
|
||||
shapes.append(.roundedRectLine(startPoint: CGPoint(x: dismissFrame.minX, y: dismissFrame.minY + floor((dismissFrame.height - lineDiameter) / 2.0)), width: 60.0, diameter: lineDiameter))
|
||||
|
||||
shimmerNode.update(backgroundColor: item.presentationData.theme.list.itemBlocksBackgroundColor, foregroundColor: item.presentationData.theme.list.mediaPlaceholderColor, shimmeringColor: item.presentationData.theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.4), shapes: shapes, size: layout.contentSize)
|
||||
} else if let shimmerNode = strongSelf.placeholderNode {
|
||||
strongSelf.placeholderNode = nil
|
||||
|
@ -338,7 +338,7 @@ public class ItemListPermanentInviteLinkItemNode: ListViewItemNode, ItemListItem
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
if !item.displayImporters {
|
||||
|
@ -178,7 +178,7 @@ public class ItemListAddressItemNode: ListViewItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
if !item.displayDecorations {
|
||||
|
@ -501,7 +501,7 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
|
||||
let baseHeight = nameNodeLayout.size.height + nameSpacing + statusNodeLayout.size.height + 30.0
|
||||
contentSize = CGSize(width: params.width, height: max(baseHeight, verticalInset * 2.0 + 66.0))
|
||||
if withTopInset || hasCorners {
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
} else {
|
||||
let topInset: CGFloat
|
||||
switch neighbors.top {
|
||||
|
@ -168,7 +168,7 @@ class ItemListPeerActionItemNode: ListViewItemNode {
|
||||
case .generic:
|
||||
verticalInset = 11.0
|
||||
verticalOffset = 0.0
|
||||
leftInset = (item.icon == nil ? 16.0 : 59.0) + params.leftInset
|
||||
leftInset = (item.icon == nil ? 16.0 : 65.0) + params.leftInset
|
||||
case .peerList:
|
||||
verticalInset = 14.0
|
||||
verticalOffset = 0.0
|
||||
@ -191,7 +191,7 @@ class ItemListPeerActionItemNode: ListViewItemNode {
|
||||
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: titleLayout.size.height + verticalInset * 2.0)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -838,7 +838,7 @@ public class ItemListPeerItemNode: ItemListRevealOptionsItemNode, ItemListItemNo
|
||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - editingOffset - rightInset - labelLayout.size.width - labelInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - editingOffset - rightInset - labelLayout.size.width - labelInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
var insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
var insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
if !item.hasTopGroupInset {
|
||||
switch neighbors.top {
|
||||
case .none:
|
||||
|
@ -388,7 +388,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
|
||||
let verticalInset: CGFloat = 11.0
|
||||
let titleSpacing: CGFloat = 2.0
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
var editableControlSizeAndApply: (CGFloat, (CGFloat) -> ItemListEditableControlNode)?
|
||||
|
@ -120,11 +120,15 @@ public func itemListNeighborsPlainInsets(_ neighbors: ItemListNeighbors) -> UIEd
|
||||
return insets
|
||||
}
|
||||
|
||||
public func itemListNeighborsGroupedInsets(_ neighbors: ItemListNeighbors) -> UIEdgeInsets {
|
||||
public func itemListNeighborsGroupedInsets(_ neighbors: ItemListNeighbors, _ params: ListViewItemLayoutParams) -> UIEdgeInsets {
|
||||
let topInset: CGFloat
|
||||
switch neighbors.top {
|
||||
case .none:
|
||||
topInset = UIScreenPixel + 35.0
|
||||
if itemListHasRoundedBlockLayout(params) {
|
||||
topInset = UIScreenPixel + 24.0
|
||||
} else {
|
||||
topInset = UIScreenPixel + 35.0
|
||||
}
|
||||
case .sameSection:
|
||||
topInset = 0.0
|
||||
case let .otherSection(otherInset):
|
||||
|
@ -174,7 +174,7 @@ public class ItemListActionItemNode: ListViewItemNode, ItemListItemNode {
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: titleLayout.size.height + 22.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -151,7 +151,7 @@ public class ItemListCheckboxItemNode: ListViewItemNode {
|
||||
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: titleLayout.size.height + 22.0)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -330,7 +330,7 @@ public class ItemListDisclosureItemNode: ListViewItemNode, ItemListItemNode {
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: height)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -226,7 +226,7 @@ public class InfoItemNode: ListViewItemNode {
|
||||
|
||||
let insets: UIEdgeInsets
|
||||
if let neighbors = neighbors {
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
} else {
|
||||
insets = UIEdgeInsets()
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ public class ItemListMultilineInputItemNode: ListViewItemNode, ASEditableTextNod
|
||||
}
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: contentHeight)
|
||||
let insets = item.noInsets ? UIEdgeInsets() : itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = item.noInsets ? UIEdgeInsets() : itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -211,7 +211,7 @@ public class ItemListMultilineTextItemNode: ListViewItemNode {
|
||||
insets = itemListNeighborsPlainInsets(neighbors)
|
||||
case .blocks:
|
||||
contentSize = CGSize(width: params.width, height: titleLayout.size.height + 22.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -130,7 +130,7 @@ public class ItemListPlaceholderItemNode: ListViewItemNode, ItemListItemNode {
|
||||
itemBackgroundColor = item.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: height)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
return (ListViewItemNodeLayout(contentSize: contentSize, insets: insets), { [weak self] in
|
||||
|
@ -251,7 +251,7 @@ public class ItemListSingleLineInputItemNode: ListViewItemNode, UITextFieldDeleg
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: max(titleLayout.size.height, measureTitleLayout.size.height) + 22.0)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -221,7 +221,7 @@ public class ItemListSwitchItemNode: ListViewItemNode, ItemListItemNode {
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: 44.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
if item.disableLeadingInset {
|
||||
|
@ -134,7 +134,7 @@ public class ItemListTextItemNode: ListViewItemNode, ItemListItemNode {
|
||||
|
||||
let contentSize: CGSize
|
||||
|
||||
var insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
var insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
if case .large = item.text {
|
||||
insets.top = 14.0
|
||||
bottomInset = -6.0
|
||||
|
@ -253,7 +253,7 @@ public class ItemListVenueItemNode: ListViewItemNode, ItemListItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: max(minHeight, rawHeight))
|
||||
|
@ -95,7 +95,10 @@ final class JoinLinkPreviewPeerContentNode: ASDisplayNode, ShareContentContainer
|
||||
let itemTheme = SelectablePeerNodeTheme(textColor: theme.actionSheet.primaryTextColor, secretTextColor: .green, selectedTextColor: theme.actionSheet.controlAccentColor, checkBackgroundColor: theme.actionSheet.opaqueItemBackgroundColor, checkFillColor: theme.actionSheet.controlAccentColor, checkColor: theme.actionSheet.opaqueItemBackgroundColor, avatarPlaceholderColor: theme.list.mediaPlaceholderColor)
|
||||
|
||||
if case let .invite(isGroup, _, _, memberCount, members) = content {
|
||||
self.peerNodes = members.map { peer in
|
||||
self.peerNodes = members.compactMap { peer in
|
||||
guard peer.id != context.account.peerId else {
|
||||
return nil
|
||||
}
|
||||
let node = SelectablePeerNode()
|
||||
node.setup(context: context, theme: theme, strings: strings, peer: EngineRenderedPeer(peer: peer), synchronousLoad: false)
|
||||
node.theme = itemTheme
|
||||
|
@ -198,7 +198,7 @@ class ChatSlowmodeItemNode: ListViewItemNode {
|
||||
}
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -208,7 +208,7 @@ class GroupStickerPackCurrentItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
let leftInset: CGFloat = 65.0 + params.leftInset
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: 59.0)
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
|
@ -225,7 +225,7 @@ public class ItemListCallListItemNode: ListViewItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
if !item.displayDecorations {
|
||||
|
@ -187,7 +187,7 @@ class ItemListSecretChatKeyItemNode: ListViewItemNode {
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: 22.0 + titleLayout.size.height)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -192,7 +192,7 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
|
||||
}
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -93,7 +93,7 @@ class PeersNearbyHeaderItemNode: ListViewItemNode {
|
||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: attributedText, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: params.width - params.rightInset - leftInset * 2.0, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: topInset + titleLayout.size.height)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
||||
|
@ -226,7 +226,7 @@ private final class AutodownloadDataUsagePickerItemNode: ListViewItemNode {
|
||||
let (customTextLayout, customTextApply) = makeCustomTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.strings.AutoDownloadSettings_DataUsageCustom, font: Font.regular(13.0), textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: CGFloat.greatestFiniteMagnitude), alignment: .center, lineSpacing: 0.0, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -200,7 +200,7 @@ private final class AutodownloadSizeLimitItemNode: ListViewItemNode {
|
||||
let (maxTextLayout, maxTextApply) = makeMaxTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: dataSizeString(1536 * 1024 * 1024, formatting: formatting), font: Font.regular(13.0), textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: CGFloat.greatestFiniteMagnitude), alignment: .center, lineSpacing: 0.0, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -125,7 +125,7 @@ private final class CalculatingCacheSizeItemNode: ListViewItemNode {
|
||||
itemBackgroundColor = item.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: titleLayout.size.height + 22.0 + 24.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -186,7 +186,7 @@ private final class KeepMediaDurationPickerItemNode: ListViewItemNode {
|
||||
}
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -201,7 +201,7 @@ private final class MaximumCacheSizePickerItemNode: ListViewItemNode {
|
||||
}
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 88.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -141,7 +141,7 @@ private final class ProxySettingsActionItemNode: ListViewItemNode {
|
||||
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: 22.0 + titleLayout.size.height)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -265,7 +265,7 @@ private final class ProxySettingsServerItemNode: ItemListRevealOptionsItemNode {
|
||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .middle, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: 64.0)
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
|
@ -203,7 +203,7 @@ private final class StorageUsageItemNode: ListViewItemNode {
|
||||
}
|
||||
|
||||
contentSize = CGSize(width: params.width, height: textOrigin.y + 34.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -161,7 +161,7 @@ private final class WebBrowserItemNode: ListViewItemNode {
|
||||
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: 22.0 + titleLayout.size.height)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -199,7 +199,7 @@ class LocalizationListItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
let (subtitleLayout, subtitleApply) = makeSubtitleLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.subtitle, font: subtitleFont, textColor: item.presentationData.theme.list.itemPrimaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 50.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: titleLayout.size.height + 1.0 + subtitleLayout.size.height + 8.0 * 2.0)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -235,7 +235,7 @@ public class NotificationsCategoryItemListItemNode: ListViewItemNode, ItemListIt
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: height)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -222,7 +222,7 @@ private enum NotificationsPeerCategoryEntry: ItemListNodeEntry {
|
||||
case let .exceptionsHeader(_, text):
|
||||
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
|
||||
case let .addException(theme, text):
|
||||
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.addPersonIcon(theme), title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
|
||||
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.plusIconImage(theme), title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
|
||||
arguments.addException()
|
||||
})
|
||||
case let .exception(_, _, _, dateTimeFormat, nameDisplayOrder, peer, description, _, editing, revealed):
|
||||
|
@ -174,7 +174,7 @@ class ForwardPrivacyChatPreviewItemNode: ListViewItemNode {
|
||||
if let node = node {
|
||||
contentSize.height += node.frame.size.height
|
||||
}
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -330,7 +330,7 @@ class ItemListRecentSessionItemNode: ItemListRevealOptionsItemNode {
|
||||
let (appLayout, appApply) = makeAppLayout(TextNodeLayoutArguments(attributedString: appAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let (locationLayout, locationApply) = makeLocationLayout(TextNodeLayoutArguments(attributedString: locationAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: verticalInset * 2.0 + titleLayout.size.height + titleSpacing + appLayout.size.height + textSpacing + locationLayout.size.height)
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
|
@ -260,7 +260,7 @@ class ItemListWebsiteItemNode: ItemListRevealOptionsItemNode {
|
||||
let (appLayout, appApply) = makeAppLayout(TextNodeLayoutArguments(attributedString: appAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let (locationLayout, locationApply) = makeLocationLayout(TextNodeLayoutArguments(attributedString: locationAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - editingOffset - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
let contentSize = CGSize(width: params.width, height: 75.0)
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
|
@ -18,6 +18,7 @@ import StickerResources
|
||||
import AnimatedStickerNode
|
||||
import TelegramAnimatedStickerNode
|
||||
import AvatarNode
|
||||
import UndoUI
|
||||
|
||||
private func closeButtonImage(theme: PresentationTheme) -> UIImage? {
|
||||
return generateImage(CGSize(width: 30.0, height: 30.0), contextGenerator: { size, context in
|
||||
@ -391,6 +392,74 @@ private class RecentSessionScreenNode: ViewControllerTracingNode, UIScrollViewDe
|
||||
}
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
|
||||
self.wrappingScrollNode.view.contentInsetAdjustmentBehavior = .never
|
||||
}
|
||||
|
||||
self.dimNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dimTapGesture)))
|
||||
|
||||
let titleGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.handleTitleLongPress(_:)))
|
||||
self.titleNode.view.addGestureRecognizer(titleGestureRecognizer)
|
||||
|
||||
let deviceGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.handleDeviceLongPress(_:)))
|
||||
self.deviceValueNode.view.addGestureRecognizer(deviceGestureRecognizer)
|
||||
|
||||
let locationGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.handleLocationLongPress(_:)))
|
||||
self.locationValueNode.view.addGestureRecognizer(locationGestureRecognizer)
|
||||
|
||||
let ipGestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.handleIpLongPress(_:)))
|
||||
self.ipValueNode.view.addGestureRecognizer(ipGestureRecognizer)
|
||||
}
|
||||
|
||||
@objc private func handleTitleLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) {
|
||||
if gestureRecognizer.state == .began {
|
||||
self.displayCopyContextMenu(self.titleNode, self.titleNode.attributedText?.string ?? "")
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func handleDeviceLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) {
|
||||
if gestureRecognizer.state == .began {
|
||||
self.displayCopyContextMenu(self.deviceValueNode, self.deviceValueNode.attributedText?.string ?? "")
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func handleLocationLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) {
|
||||
if gestureRecognizer.state == .began {
|
||||
self.displayCopyContextMenu(self.locationValueNode, self.locationValueNode.attributedText?.string ?? "")
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func handleIpLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) {
|
||||
if gestureRecognizer.state == .began {
|
||||
self.displayCopyContextMenu(self.ipValueNode, self.ipValueNode.attributedText?.string ?? "")
|
||||
}
|
||||
}
|
||||
|
||||
private func displayCopyContextMenu(_ node: ASDisplayNode, _ string: String) {
|
||||
if !string.isEmpty {
|
||||
var actions: [ContextMenuAction] = []
|
||||
actions.append(ContextMenuAction(content: .text(title: self.presentationData.strings.Conversation_ContextMenuCopy, accessibilityLabel: self.presentationData.strings.Conversation_ContextMenuCopy), action: { [weak self] in
|
||||
UIPasteboard.general.string = string
|
||||
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .copy(text: presentationData.strings.Conversation_TextCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}))
|
||||
let contextMenuController = ContextMenuController(actions: actions)
|
||||
self.controller?.present(contextMenuController, in: .window(.root), with: ContextMenuControllerPresentationArguments(sourceNodeAndRect: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
return (node, node.bounds.insetBy(dx: 0.0, dy: -2.0), strongSelf, strongSelf.view.bounds)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
func updatePresentationData(_ presentationData: PresentationData) {
|
||||
guard !self.animatedOut else {
|
||||
return
|
||||
@ -427,16 +496,6 @@ private class RecentSessionScreenNode: ViewControllerTracingNode, UIScrollViewDe
|
||||
self.cancelButton.setImage(closeButtonImage(theme: self.presentationData.theme), for: .normal)
|
||||
self.terminateButton.updateTheme(SolidRoundedButtonTheme(backgroundColor: self.presentationData.theme.list.itemBlocksBackgroundColor, foregroundColor: self.presentationData.theme.list.itemDestructiveColor))
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
|
||||
self.wrappingScrollNode.view.contentInsetAdjustmentBehavior = .never
|
||||
}
|
||||
|
||||
self.dimNode.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dimTapGesture)))
|
||||
}
|
||||
|
||||
@objc func cancelButtonPressed() {
|
||||
self.animateOut()
|
||||
@ -486,6 +545,13 @@ private class RecentSessionScreenNode: ViewControllerTracingNode, UIScrollViewDe
|
||||
offsetCompleted = true
|
||||
internalCompletion()
|
||||
})
|
||||
|
||||
|
||||
self.controller?.window?.forEachController { c in
|
||||
if let c = c as? UndoOverlayController {
|
||||
c.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var passthroughHitTestImpl: ((CGPoint) -> UIView?)?
|
||||
|
@ -14,17 +14,6 @@ import SearchBarNode
|
||||
import SearchUI
|
||||
import ChatListSearchItemHeader
|
||||
|
||||
/*extension NavigationBarSearchContentNode: ItemListControllerSearchNavigationContentNode {
|
||||
public func activate() {
|
||||
}
|
||||
|
||||
public func deactivate() {
|
||||
}
|
||||
|
||||
public func setQueryUpdated(_ f: @escaping (String) -> Void) {
|
||||
}
|
||||
}*/
|
||||
|
||||
extension SettingsSearchableItemIcon {
|
||||
func image() -> UIImage? {
|
||||
switch self {
|
||||
@ -298,8 +287,14 @@ private enum SettingsSearchRecentEntry: Comparable, Identifiable {
|
||||
|
||||
func item(account: Account, theme: PresentationTheme, strings: PresentationStrings, interaction: SettingsSearchInteraction) -> ListViewItem {
|
||||
switch self {
|
||||
case let .recent(_, item, header), let .faq(_, item, header):
|
||||
return SettingsSearchRecentItem(account: account, theme: theme, strings: strings, title: item.title, breadcrumbs: item.breadcrumbs, action: {
|
||||
case let .recent(_, item, header):
|
||||
return SettingsSearchRecentItem(account: account, theme: theme, strings: strings, title: item.title, breadcrumbs: item.breadcrumbs, isFaq: false, action: {
|
||||
interaction.openItem(item)
|
||||
}, deleted: {
|
||||
interaction.deleteRecentItem(item.id)
|
||||
}, header: header)
|
||||
case let .faq(_, item, header):
|
||||
return SettingsSearchRecentItem(account: account, theme: theme, strings: strings, title: item.title, breadcrumbs: item.breadcrumbs, isFaq: true, action: {
|
||||
interaction.openItem(item)
|
||||
}, deleted: {
|
||||
interaction.deleteRecentItem(item.id)
|
||||
|
@ -19,17 +19,19 @@ class SettingsSearchRecentItem: ListViewItem {
|
||||
let account: Account
|
||||
let title: String
|
||||
let breadcrumbs: [String]
|
||||
let isFaq: Bool
|
||||
let action: () -> Void
|
||||
let deleted: () -> Void
|
||||
|
||||
let header: ListViewItemHeader?
|
||||
|
||||
init(account: Account, theme: PresentationTheme, strings: PresentationStrings, title: String, breadcrumbs: [String], action: @escaping () -> Void, deleted: @escaping () -> Void, header: ListViewItemHeader) {
|
||||
init(account: Account, theme: PresentationTheme, strings: PresentationStrings, title: String, breadcrumbs: [String], isFaq: Bool, action: @escaping () -> Void, deleted: @escaping () -> Void, header: ListViewItemHeader) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.account = account
|
||||
self.title = title
|
||||
self.breadcrumbs = breadcrumbs
|
||||
self.isFaq = isFaq
|
||||
self.action = action
|
||||
self.deleted = deleted
|
||||
self.header = header
|
||||
@ -227,7 +229,12 @@ class SettingsSearchRecentItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
strongSelf.updateLayout(size: nodeLayout.contentSize, leftInset: params.leftInset, rightInset: params.rightInset)
|
||||
|
||||
strongSelf.setRevealOptions((left: [], right: [ItemListRevealOption(key: RevealOptionKey.delete.rawValue, title: item.strings.Common_Delete, icon: .none, color: item.theme.list.itemDisclosureActions.destructive.fillColor, textColor: item.theme.list.itemDisclosureActions.destructive.foregroundColor)]))
|
||||
var revealOptions: [ItemListRevealOption] = []
|
||||
if item.isFaq {
|
||||
} else {
|
||||
revealOptions.append(ItemListRevealOption(key: RevealOptionKey.delete.rawValue, title: item.strings.Common_Delete, icon: .none, color: item.theme.list.itemDisclosureActions.destructive.fillColor, textColor: item.theme.list.itemDisclosureActions.destructive.foregroundColor))
|
||||
}
|
||||
strongSelf.setRevealOptions((left: [], right: revealOptions))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -134,7 +134,7 @@ class SettingsSearchResultItemNode: ListViewItemNode {
|
||||
var leftInset: CGFloat = params.leftInset
|
||||
let contentInset: CGFloat = 58.0
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
leftInset += contentInset
|
||||
|
||||
|
@ -955,6 +955,26 @@ public func installedStickerPacksController(context: AccountContext, mode: Insta
|
||||
if case .modal = mode {
|
||||
controller.navigationPresentation = .modal
|
||||
}
|
||||
|
||||
var alreadyReadIds = Set<ItemCollectionId>()
|
||||
controller.visibleEntriesUpdated = { entries in
|
||||
var unreadIds: [ItemCollectionId] = []
|
||||
for entry in entries {
|
||||
if let entry = entry as? InstalledStickerPacksEntry {
|
||||
if case let .trendingPack(_, _, _, info, _, _, _, unread, _) = entry {
|
||||
if unread && !alreadyReadIds.contains(info.id) {
|
||||
unreadIds.append(info.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !unreadIds.isEmpty {
|
||||
alreadyReadIds.formUnion(Set(unreadIds))
|
||||
|
||||
let _ = context.engine.stickers.markFeaturedStickerPacksAsSeenInteractively(ids: unreadIds).start()
|
||||
}
|
||||
}
|
||||
|
||||
controller.setReorderEntry({ (fromIndex: Int, toIndex: Int, entries: [InstalledStickerPacksEntry]) -> Signal<Bool, NoError> in
|
||||
let fromEntry = entries[fromIndex]
|
||||
guard case let .pack(_, _, _, fromPackInfo, _, _, _, _, _, _) = fromEntry else {
|
||||
|
@ -172,7 +172,7 @@ class BubbleSettingsRadiusItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 60.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
if item.disableLeadingInset {
|
||||
insets.top = 0.0
|
||||
|
@ -567,16 +567,17 @@ private struct ThemeCarouselThemeItemNodeTransition {
|
||||
let updates: [ListViewUpdateItem]
|
||||
let crossfade: Bool
|
||||
let entries: [ThemeCarouselThemeEntry]
|
||||
let updatePosition: Bool
|
||||
}
|
||||
|
||||
private func preparedTransition(context: AccountContext, action: @escaping (PresentationThemeReference) -> Void, contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?, from fromEntries: [ThemeCarouselThemeEntry], to toEntries: [ThemeCarouselThemeEntry], crossfade: Bool) -> ThemeCarouselThemeItemNodeTransition {
|
||||
private func preparedTransition(context: AccountContext, action: @escaping (PresentationThemeReference) -> Void, contextAction: ((PresentationThemeReference, ASDisplayNode, ContextGesture?) -> Void)?, from fromEntries: [ThemeCarouselThemeEntry], to toEntries: [ThemeCarouselThemeEntry], crossfade: Bool, updatePosition: Bool) -> ThemeCarouselThemeItemNodeTransition {
|
||||
let (deleteIndices, indicesAndItems, updateIndices) = mergeListsStableWithUpdates(leftList: fromEntries, rightList: toEntries)
|
||||
|
||||
let deletions = deleteIndices.map { ListViewDeleteItem(index: $0, directionHint: nil) }
|
||||
let insertions = indicesAndItems.map { ListViewInsertItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, action: action, contextAction: contextAction), directionHint: .Down) }
|
||||
let updates = updateIndices.map { ListViewUpdateItem(index: $0.0, previousIndex: $0.2, item: $0.1.item(context: context, action: action, contextAction: contextAction), directionHint: nil) }
|
||||
|
||||
return ThemeCarouselThemeItemNodeTransition(deletions: deletions, insertions: insertions, updates: updates, crossfade: crossfade, entries: toEntries)
|
||||
return ThemeCarouselThemeItemNodeTransition(deletions: deletions, insertions: insertions, updates: updates, crossfade: crossfade, entries: toEntries, updatePosition: false)
|
||||
}
|
||||
|
||||
private func ensureThemeVisible(listNode: ListView, themeReference: PresentationThemeReference, animated: Bool) -> Bool {
|
||||
@ -612,6 +613,8 @@ class ThemeCarouselThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
private var item: ThemeCarouselThemeItem?
|
||||
private var layoutParams: ListViewItemLayoutParams?
|
||||
|
||||
private var tapping = false
|
||||
|
||||
var tag: ItemListItemTag? {
|
||||
return self.item?.tag
|
||||
}
|
||||
@ -667,7 +670,7 @@ class ThemeCarouselThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
options.insert(.Synchronous)
|
||||
|
||||
var scrollToItem: ListViewScrollToItem?
|
||||
if !self.initialized {
|
||||
if !self.initialized || !self.tapping {
|
||||
if let index = transition.entries.firstIndex(where: { entry in
|
||||
return entry.themeReference.index == item.currentTheme.index
|
||||
}) {
|
||||
@ -687,7 +690,7 @@ class ThemeCarouselThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 133.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
@ -775,13 +778,17 @@ class ThemeCarouselThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
|
||||
let action: (PresentationThemeReference) -> Void = { [weak self] themeReference in
|
||||
if let strongSelf = self {
|
||||
strongSelf.tapping = true
|
||||
strongSelf.item?.updatedTheme(themeReference)
|
||||
let _ = ensureThemeVisible(listNode: strongSelf.listNode, themeReference: themeReference, animated: true)
|
||||
Queue.mainQueue().after(0.2) {
|
||||
strongSelf.tapping = false
|
||||
}
|
||||
}
|
||||
}
|
||||
let previousEntries = strongSelf.entries ?? []
|
||||
let crossfade = previousEntries.count != entries.count
|
||||
let transition = preparedTransition(context: item.context, action: action, contextAction: item.contextAction, from: previousEntries, to: entries, crossfade: crossfade)
|
||||
let transition = preparedTransition(context: item.context, action: action, contextAction: item.contextAction, from: previousEntries, to: entries, crossfade: crossfade, updatePosition: false)
|
||||
strongSelf.enqueueTransition(transition)
|
||||
|
||||
strongSelf.entries = entries
|
||||
|
@ -432,7 +432,7 @@ class ThemeGridThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let rows = ceil(CGFloat(item.themes.count) / CGFloat(imageCount))
|
||||
|
||||
contentSize = CGSize(width: params.width, height: minSpacing + rows * (itemSize.height + itemSpacing))
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -711,10 +711,12 @@ class ThemeSettingsAccentColorItemNode: ListViewItemNode, ItemListItemNode {
|
||||
private var item: ThemeSettingsAccentColorItem?
|
||||
private var layoutParams: ListViewItemLayoutParams?
|
||||
|
||||
private var tapping = false
|
||||
|
||||
var tag: ItemListItemTag? {
|
||||
return self.item?.tag
|
||||
}
|
||||
|
||||
|
||||
init() {
|
||||
self.containerNode = ASDisplayNode()
|
||||
|
||||
@ -761,7 +763,7 @@ class ThemeSettingsAccentColorItemNode: ListViewItemNode, ItemListItemNode {
|
||||
|
||||
let options = ListViewDeleteAndInsertOptions()
|
||||
var scrollToItem: ListViewScrollToItem?
|
||||
if !self.initialized || transition.updatePosition {
|
||||
if !self.initialized || transition.updatePosition || !self.tapping {
|
||||
if let index = item.colors.firstIndex(where: { $0.index == item.currentColor?.index }) {
|
||||
scrollToItem = ListViewScrollToItem(index: index, position: .bottom(-70.0), animated: false, curve: .Default(duration: 0.0), directionHint: .Down)
|
||||
self.initialized = true
|
||||
@ -786,7 +788,7 @@ class ThemeSettingsAccentColorItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 60.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
@ -912,7 +914,11 @@ class ThemeSettingsAccentColorItemNode: ListViewItemNode, ItemListItemNode {
|
||||
}
|
||||
item.openColorPicker(create)
|
||||
} else {
|
||||
strongSelf.tapping = true
|
||||
item.updated(color)
|
||||
Queue.mainQueue().after(0.2) {
|
||||
strongSelf.tapping = false
|
||||
}
|
||||
}
|
||||
let _ = ensureColorVisible(listNode: strongSelf.listNode, accentColor: color, animated: true)
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class ThemeSettingsAppIconItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 116.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -141,7 +141,7 @@ class ThemeSettingsBrightnessItemNode: ListViewItemNode {
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 60.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -199,7 +199,7 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode {
|
||||
for node in nodes {
|
||||
contentSize.height += node.frame.size.height
|
||||
}
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
|
@ -187,7 +187,7 @@ class ThemeSettingsFontSizeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 60.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
if item.disableLeadingInset {
|
||||
insets.top = 0.0
|
||||
|
@ -469,6 +469,8 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
var tag: ItemListItemTag? {
|
||||
return self.item?.tag
|
||||
}
|
||||
|
||||
private var tapping = false
|
||||
|
||||
init() {
|
||||
self.containerNode = ASDisplayNode()
|
||||
@ -521,7 +523,7 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
options.insert(.Synchronous)
|
||||
|
||||
var scrollToItem: ListViewScrollToItem?
|
||||
if !self.initialized {
|
||||
if !self.initialized || !self.tapping {
|
||||
if let index = transition.entries.firstIndex(where: { entry in
|
||||
return entry.theme.index == item.currentTheme.index
|
||||
}) {
|
||||
@ -541,7 +543,7 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
contentSize = CGSize(width: params.width, height: 116.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
let layoutSize = layout.size
|
||||
@ -650,8 +652,12 @@ class ThemeSettingsThemeItemNode: ListViewItemNode, ItemListItemNode {
|
||||
|
||||
let action: (PresentationThemeReference) -> Void = { [weak self] themeReference in
|
||||
if let strongSelf = self {
|
||||
strongSelf.tapping = true
|
||||
strongSelf.item?.updatedTheme(themeReference)
|
||||
let _ = ensureThemeVisible(listNode: strongSelf.listNode, themeReference: themeReference, animated: true)
|
||||
Queue.mainQueue().after(0.2) {
|
||||
strongSelf.tapping = false
|
||||
}
|
||||
}
|
||||
}
|
||||
let previousEntries = strongSelf.entries ?? []
|
||||
|
@ -147,7 +147,7 @@ class MessageStatsOverviewItemNode: ListViewItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let valueFont = Font.semibold(item.presentationData.fontSize.itemListBaseFontSize)
|
||||
|
@ -159,7 +159,7 @@ class StatsGraphItemNode: ListViewItemNode {
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: 361.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
var visibilityHeight = currentVisibilityHeight
|
||||
|
@ -311,7 +311,7 @@ public class StatsMessageItemNode: ListViewItemNode, ItemListItemNode {
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: height)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -187,7 +187,7 @@ class StatsOverviewItemNode: ListViewItemNode {
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let valueFont = Font.semibold(item.presentationData.fontSize.itemListBaseFontSize)
|
||||
|
@ -858,6 +858,12 @@ private final class PeerInvitationImportersContextImpl {
|
||||
self.actionDisposables.dispose()
|
||||
}
|
||||
|
||||
func reload() {
|
||||
self.loadedFromCache = true
|
||||
self.populateCache = true
|
||||
self.loadMore()
|
||||
}
|
||||
|
||||
func loadMore() {
|
||||
if self.isLoadingMore {
|
||||
return
|
||||
@ -1070,6 +1076,12 @@ public final class PeerInvitationImportersContext {
|
||||
}
|
||||
}
|
||||
|
||||
public func reload() {
|
||||
self.impl.with { impl in
|
||||
impl.reload()
|
||||
}
|
||||
}
|
||||
|
||||
public func update(_ peerId: EnginePeer.Id, action: UpdateAction) {
|
||||
self.impl.with { impl in
|
||||
impl.update(peerId, action: action)
|
||||
|
@ -5959,6 +5959,8 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
}
|
||||
|
||||
if self.isSettings {
|
||||
(self.controller?.parent as? TabBarController)?.updateIsTabBarHidden(true, transition: .animated(duration: 0.3, curve: .linear))
|
||||
|
||||
if let settings = self.data?.globalSettings {
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .list, placeholder: self.presentationData.strings.Settings_Search, hasBackground: true, hasSeparator: true, contentNode: SettingsSearchContainerNode(context: self.context, openResult: { [weak self] result in
|
||||
if let strongSelf = self, let navigationController = strongSelf.controller?.navigationController as? NavigationController {
|
||||
@ -6038,6 +6040,10 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
self.searchDisplayController = nil
|
||||
searchDisplayController.deactivate(placeholder: nil)
|
||||
|
||||
if self.isSettings {
|
||||
(self.controller?.parent as? TabBarController)?.updateIsTabBarHidden(false, transition: .animated(duration: 0.3, curve: .linear))
|
||||
}
|
||||
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: 0.35, curve: .easeInOut)
|
||||
if let navigationBar = self.controller?.navigationBar {
|
||||
transition.updateAlpha(node: navigationBar, alpha: 1.0)
|
||||
|
@ -225,7 +225,7 @@ class UpdateInfoItemNode: ListViewItemNode {
|
||||
insets = itemListNeighborsPlainInsets(neighbors)
|
||||
case .blocks:
|
||||
contentSize = CGSize(width: params.width, height: 88.0 + textLayout.size.height + inset)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
Loading…
x
Reference in New Issue
Block a user