mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Fixes
This commit is contained in:
parent
8aefa19d31
commit
dacdd9e1ae
@ -162,7 +162,7 @@ func preparedChatMediaInputGridEntryTransition(account: Account, view: ItemColle
|
||||
return ChatMediaInputGridTransition(deletions: deletions, insertions: insertions, updates: updates, updateFirstIndexInSectionOffset: firstIndexInSectionOffset, stationaryItems: stationaryItems, scrollToItem: scrollToItem, updateOpaqueState: opaqueState, animated: animated)
|
||||
}
|
||||
|
||||
func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: OrderedItemListView?, recentStickers: OrderedItemListView?, temporaryPackOrder: [ItemCollectionId]? = nil, trendingIsDismissed: Bool = false, peerSpecificPack: PeerSpecificPackData?, canInstallPeerSpecificPack: CanInstallPeerSpecificPack, theme: PresentationTheme, strings: PresentationStrings, hasGifs: Bool = true, hasSettings: Bool = true, expanded: Bool = false) -> [ChatMediaInputPanelEntry] {
|
||||
func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: OrderedItemListView?, recentStickers: OrderedItemListView?, temporaryPackOrder: [ItemCollectionId]? = nil, trendingIsDismissed: Bool = false, peerSpecificPack: PeerSpecificPackData?, canInstallPeerSpecificPack: CanInstallPeerSpecificPack, theme: PresentationTheme, strings: PresentationStrings, hasGifs: Bool = true, hasSettings: Bool = true, expanded: Bool = false, reorderable: Bool = false) -> [ChatMediaInputPanelEntry] {
|
||||
var entries: [ChatMediaInputPanelEntry] = []
|
||||
if hasGifs {
|
||||
entries.append(.recentGifs(theme, strings, expanded))
|
||||
@ -227,7 +227,7 @@ func chatMediaInputPanelEntries(view: ItemCollectionsView, savedStickers: Ordere
|
||||
}
|
||||
|
||||
for (_, info, topItem) in sortedPacks {
|
||||
entries.append(.stickerPack(index: index, info: info, topItem: topItem, theme: theme, expanded: expanded))
|
||||
entries.append(.stickerPack(index: index, info: info, topItem: topItem, theme: theme, expanded: expanded, reorderable: reorderable))
|
||||
index += 1
|
||||
}
|
||||
|
||||
@ -624,7 +624,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
||||
self?.lastReorderItemIndex = toIndex
|
||||
|
||||
let fromEntry = entries[fromIndex]
|
||||
guard case let .stickerPack(_, fromPackInfo, _, _, _) = fromEntry else {
|
||||
guard case let .stickerPack(_, fromPackInfo, _, _, _, _) = fromEntry else {
|
||||
return .single(false)
|
||||
}
|
||||
var referenceId: ItemCollectionId?
|
||||
@ -632,7 +632,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
||||
var afterAll = false
|
||||
if toIndex < entries.count {
|
||||
switch entries[toIndex] {
|
||||
case let .stickerPack(_, toPackInfo, _, _, _):
|
||||
case let .stickerPack(_, toPackInfo, _, _, _, _):
|
||||
referenceId = toPackInfo.id
|
||||
default:
|
||||
if entries[toIndex] < fromEntry {
|
||||
@ -648,7 +648,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
||||
var currentIds: [ItemCollectionId] = []
|
||||
for entry in entries {
|
||||
switch entry {
|
||||
case let .stickerPack(_, info, _, _, _):
|
||||
case let .stickerPack(_, info, _, _, _, _):
|
||||
currentIds.append(info.id)
|
||||
default:
|
||||
break
|
||||
@ -705,7 +705,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
||||
var currentIds: [ItemCollectionId] = []
|
||||
for entry in entries {
|
||||
switch entry {
|
||||
case let .stickerPack(_, info, _, _, _):
|
||||
case let .stickerPack(_, info, _, _, _, _):
|
||||
currentIds.append(info.id)
|
||||
default:
|
||||
break
|
||||
@ -1139,7 +1139,7 @@ final class ChatMediaInputNode: ChatInputNode {
|
||||
trendingIsDismissed = true
|
||||
}
|
||||
|
||||
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, temporaryPackOrder: temporaryPackOrder, trendingIsDismissed: trendingIsDismissed, peerSpecificPack: peerSpecificPack.0, canInstallPeerSpecificPack: peerSpecificPack.1, theme: theme, strings: strings, expanded: panelExpanded)
|
||||
let panelEntries = chatMediaInputPanelEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, temporaryPackOrder: temporaryPackOrder, trendingIsDismissed: trendingIsDismissed, peerSpecificPack: peerSpecificPack.0, canInstallPeerSpecificPack: peerSpecificPack.1, theme: theme, strings: strings, expanded: panelExpanded, reorderable: true)
|
||||
let gifPaneEntries = chatMediaInputPanelGifModeEntries(theme: theme, strings: strings, reactions: reactions, animatedEmojiStickers: animatedEmojiStickers, expanded: panelExpanded)
|
||||
var gridEntries = chatMediaInputGridEntries(view: view, savedStickers: savedStickers, recentStickers: recentStickers, peerSpecificPack: peerSpecificPack.0, canInstallPeerSpecificPack: peerSpecificPack.1, trendingPacks: trendingPacks, installedPacks: installedPacks, trendingIsDismissed: trendingIsDismissed, strings: strings, theme: theme)
|
||||
|
||||
|
@ -37,7 +37,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||
case trending(Bool, PresentationTheme, PresentationStrings, Bool)
|
||||
case settings(PresentationTheme, PresentationStrings, Bool)
|
||||
case peerSpecific(theme: PresentationTheme, peer: Peer, expanded: Bool)
|
||||
case stickerPack(index: Int, info: StickerPackCollectionInfo, topItem: StickerPackItem?, theme: PresentationTheme, expanded: Bool)
|
||||
case stickerPack(index: Int, info: StickerPackCollectionInfo, topItem: StickerPackItem?, theme: PresentationTheme, expanded: Bool, reorderable: Bool)
|
||||
|
||||
case stickersMode(PresentationTheme, PresentationStrings, Bool)
|
||||
case savedGifs(PresentationTheme, PresentationStrings, Bool)
|
||||
@ -58,7 +58,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||
return .settings
|
||||
case .peerSpecific:
|
||||
return .peerSpecific
|
||||
case let .stickerPack(_, info, _, _, _):
|
||||
case let .stickerPack(_, info, _, _, _, _):
|
||||
return .stickerPack(info.id.id)
|
||||
case .stickersMode:
|
||||
return .stickersMode
|
||||
@ -109,8 +109,8 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .stickerPack(index, info, topItem, lhsTheme, lhsExpanded):
|
||||
if case let .stickerPack(rhsIndex, rhsInfo, rhsTopItem, rhsTheme, rhsExpanded) = rhs, index == rhsIndex, info == rhsInfo, topItem == rhsTopItem, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded {
|
||||
case let .stickerPack(index, info, topItem, lhsTheme, lhsExpanded, lhsReorderable):
|
||||
if case let .stickerPack(rhsIndex, rhsInfo, rhsTopItem, rhsTheme, rhsExpanded, rhsReorderable) = rhs, index == rhsIndex, info == rhsInfo, topItem == rhsTopItem, lhsTheme === rhsTheme, lhsExpanded == rhsExpanded, lhsReorderable == rhsReorderable {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@ -134,7 +134,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||
return false
|
||||
}
|
||||
case let .gifEmotion(lhsIndex, lhsTheme, lhsStrings, lhsEmoji, lhsFile, lhsExpanded):
|
||||
if case let .gifEmotion(rhsIndex, rhsTheme, rhsStrings, rhsEmoji, rhsFile, rhsExpanded) = rhs, lhsIndex == rhsIndex, lhsTheme === rhsTheme, lhsEmoji == rhsEmoji, lhsExpanded == rhsExpanded {
|
||||
if case let .gifEmotion(rhsIndex, rhsTheme, rhsStrings, rhsEmoji, rhsFile, rhsExpanded) = rhs, lhsIndex == rhsIndex, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsEmoji == rhsEmoji, lhsExpanded == rhsExpanded {
|
||||
if let lhsFile = lhsFile, let rhsFile = rhsFile {
|
||||
if !lhsFile.isEqual(to: rhsFile) {
|
||||
return false
|
||||
@ -185,7 +185,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||
default:
|
||||
return true
|
||||
}
|
||||
case let .stickerPack(lhsIndex, lhsInfo, _, _, _):
|
||||
case let .stickerPack(lhsIndex, lhsInfo, _, _, _, _):
|
||||
switch rhs {
|
||||
case .recentGifs, .savedStickers, .recentPacks, .peerSpecific:
|
||||
return false
|
||||
@ -197,7 +197,7 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||
}
|
||||
case .settings:
|
||||
return true
|
||||
case let .stickerPack(rhsIndex, rhsInfo, _, _, _):
|
||||
case let .stickerPack(rhsIndex, rhsInfo, _, _, _, _):
|
||||
if lhsIndex == rhsIndex {
|
||||
return lhsInfo.id.id < rhsInfo.id.id
|
||||
} else {
|
||||
@ -286,8 +286,8 @@ enum ChatMediaInputPanelEntry: Comparable, Identifiable {
|
||||
return ChatMediaInputPeerSpecificItem(context: context, inputNodeInteraction: inputNodeInteraction, collectionId: collectionId, peer: peer, theme: theme, expanded: expanded, selected: {
|
||||
inputNodeInteraction.navigateToCollectionId(collectionId)
|
||||
})
|
||||
case let .stickerPack(index, info, topItem, theme, expanded):
|
||||
return ChatMediaInputStickerPackItem(account: context.account, inputNodeInteraction: inputNodeInteraction, collectionId: info.id, collectionInfo: info, stickerPackItem: topItem, index: index, theme: theme, expanded: expanded, selected: {
|
||||
case let .stickerPack(index, info, topItem, theme, expanded, reorderable):
|
||||
return ChatMediaInputStickerPackItem(account: context.account, inputNodeInteraction: inputNodeInteraction, collectionId: info.id, collectionInfo: info, stickerPackItem: topItem, index: index, theme: theme, expanded: expanded, reorderable: reorderable, selected: {
|
||||
inputNodeInteraction.navigateToCollectionId(info.id)
|
||||
})
|
||||
case let .stickersMode(theme, strings, expanded):
|
||||
|
@ -22,12 +22,13 @@ final class ChatMediaInputStickerPackItem: ListViewItem {
|
||||
let index: Int
|
||||
let theme: PresentationTheme
|
||||
let expanded: Bool
|
||||
let reorderable: Bool
|
||||
|
||||
var selectable: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
init(account: Account, inputNodeInteraction: ChatMediaInputNodeInteraction, collectionId: ItemCollectionId, collectionInfo: StickerPackCollectionInfo, stickerPackItem: StickerPackItem?, index: Int, theme: PresentationTheme, expanded: Bool, selected: @escaping () -> Void) {
|
||||
init(account: Account, inputNodeInteraction: ChatMediaInputNodeInteraction, collectionId: ItemCollectionId, collectionInfo: StickerPackCollectionInfo, stickerPackItem: StickerPackItem?, index: Int, theme: PresentationTheme, expanded: Bool, reorderable: Bool, selected: @escaping () -> Void) {
|
||||
self.account = account
|
||||
self.inputNodeInteraction = inputNodeInteraction
|
||||
self.collectionId = collectionId
|
||||
@ -37,6 +38,7 @@ final class ChatMediaInputStickerPackItem: ListViewItem {
|
||||
self.index = index
|
||||
self.theme = theme
|
||||
self.expanded = expanded
|
||||
self.reorderable = reorderable
|
||||
}
|
||||
|
||||
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
|
||||
@ -48,7 +50,7 @@ final class ChatMediaInputStickerPackItem: ListViewItem {
|
||||
Queue.mainQueue().async {
|
||||
completion(node, {
|
||||
return (nil, { _ in
|
||||
node.updateStickerPackItem(account: self.account, info: self.collectionInfo, item: self.stickerPackItem, collectionId: self.collectionId, theme: self.theme, expanded: self.expanded)
|
||||
node.updateStickerPackItem(account: self.account, info: self.collectionInfo, item: self.stickerPackItem, collectionId: self.collectionId, theme: self.theme, expanded: self.expanded, reorderable: self.reorderable)
|
||||
node.updateAppearanceTransition(transition: .immediate)
|
||||
})
|
||||
})
|
||||
@ -59,7 +61,7 @@ final class ChatMediaInputStickerPackItem: ListViewItem {
|
||||
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
||||
Queue.mainQueue().async {
|
||||
completion(ListViewItemNodeLayout(contentSize: self.expanded ? expandedBoundingSize : boundingSize, insets: ChatMediaInputNode.setupPanelIconInsets(item: self, previousItem: previousItem, nextItem: nextItem)), { _ in
|
||||
(node() as? ChatMediaInputStickerPackItemNode)?.updateStickerPackItem(account: self.account, info: self.collectionInfo, item: self.stickerPackItem, collectionId: self.collectionId, theme: self.theme, expanded: self.expanded)
|
||||
(node() as? ChatMediaInputStickerPackItemNode)?.updateStickerPackItem(account: self.account, info: self.collectionInfo, item: self.stickerPackItem, collectionId: self.collectionId, theme: self.theme, expanded: self.expanded, reorderable: self.reorderable)
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -91,6 +93,7 @@ final class ChatMediaInputStickerPackItemNode: ListViewItemNode {
|
||||
private var currentThumbnailItem: StickerPackThumbnailItem?
|
||||
private var currentExpanded = false
|
||||
private var theme: PresentationTheme?
|
||||
private var reorderable = false
|
||||
|
||||
private let stickerFetchedDisposable = MetaDisposable()
|
||||
|
||||
@ -171,9 +174,10 @@ final class ChatMediaInputStickerPackItemNode: ListViewItemNode {
|
||||
}
|
||||
}
|
||||
|
||||
func updateStickerPackItem(account: Account, info: StickerPackCollectionInfo, item: StickerPackItem?, collectionId: ItemCollectionId, theme: PresentationTheme, expanded: Bool) {
|
||||
func updateStickerPackItem(account: Account, info: StickerPackCollectionInfo, item: StickerPackItem?, collectionId: ItemCollectionId, theme: PresentationTheme, expanded: Bool, reorderable: Bool) {
|
||||
self.currentCollectionId = collectionId
|
||||
self.account = account
|
||||
self.reorderable = reorderable
|
||||
var themeUpdated = false
|
||||
if self.theme !== theme {
|
||||
self.theme = theme
|
||||
@ -319,6 +323,9 @@ final class ChatMediaInputStickerPackItemNode: ListViewItemNode {
|
||||
}
|
||||
|
||||
override func isReorderable(at point: CGPoint) -> Bool {
|
||||
guard self.reorderable else {
|
||||
return false
|
||||
}
|
||||
if self.bounds.inset(by: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: -28.0)).contains(point) {
|
||||
return true
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ final class WebpagePreviewAccessoryPanelNode: AccessoryPanelNode {
|
||||
self.addSubnode(self.closeButton)
|
||||
|
||||
self.addSubnode(self.lineNode)
|
||||
self.addSubnode(self.iconNode)
|
||||
self.addSubnode(self.titleNode)
|
||||
self.addSubnode(self.textNode)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user