mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various Fixes
This commit is contained in:
@@ -205,48 +205,6 @@ private final class VideoStickerFrameSourceCache {
|
||||
}
|
||||
}
|
||||
|
||||
func storeUncompressedYuvaFrame(index: Int, yuvaData: Data) {
|
||||
if index < 0 || index >= maximumFrameCount {
|
||||
return
|
||||
}
|
||||
if self.isStoringFrames.contains(index) {
|
||||
return
|
||||
}
|
||||
self.isStoringFrames.insert(index)
|
||||
|
||||
let width = self.width
|
||||
let height = self.height
|
||||
|
||||
let queue = self.queue
|
||||
self.storeQueue.async { [weak self] in
|
||||
let compressedData = compressFrame(width: width, height: height, yuvaData: yuvaData)
|
||||
|
||||
queue.async {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
guard let currentSize = strongSelf.file.getSize() else {
|
||||
return
|
||||
}
|
||||
guard let compressedData = compressedData else {
|
||||
return
|
||||
}
|
||||
|
||||
strongSelf.file.seek(position: Int64(8 + index * 4 * 2))
|
||||
var offset = Int32(currentSize)
|
||||
var length = Int32(compressedData.count)
|
||||
let _ = strongSelf.file.write(&offset, count: 4)
|
||||
let _ = strongSelf.file.write(&length, count: 4)
|
||||
strongSelf.file.seek(position: Int64(currentSize))
|
||||
compressedData.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) -> Void in
|
||||
if let baseAddress = buffer.baseAddress {
|
||||
let _ = strongSelf.file.write(baseAddress, count: Int(length))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func readUncompressedYuvaFrame(index: Int) -> Data? {
|
||||
if index < 0 || index >= maximumFrameCount {
|
||||
return nil
|
||||
|
||||
@@ -292,7 +292,7 @@ private func channelMembersControllerEntries(context: AccountContext, presentati
|
||||
|
||||
var entries: [ChannelMembersEntry] = []
|
||||
|
||||
if let participants = participants {
|
||||
if let participants = participants, let contacts = contacts {
|
||||
var canAddMember: Bool = false
|
||||
if let peer = view.peers[view.peerId] as? TelegramChannel {
|
||||
canAddMember = peer.hasPermission(.inviteMembers)
|
||||
@@ -322,7 +322,7 @@ private func channelMembersControllerEntries(context: AccountContext, presentati
|
||||
var existingPeerIds = Set<PeerId>()
|
||||
|
||||
var addedContactsHeader = false
|
||||
if let contacts = contacts, !contacts.isEmpty {
|
||||
if !contacts.isEmpty {
|
||||
addedContactsHeader = true
|
||||
|
||||
entries.append(.contactsTitle(presentationData.theme, isGroup ? presentationData.strings.Group_Members_Contacts : presentationData.strings.Channel_Members_Contacts))
|
||||
@@ -603,12 +603,14 @@ public func channelMembersController(context: AccountContext, updatedPresentatio
|
||||
currentPeers = peers
|
||||
|
||||
var animateChanges = false
|
||||
if let previousContacts = previousContacts, let contacts = contacts, previousContacts.count >= contacts.count {
|
||||
if let previousContacts = previousContacts, let contacts = contacts, let previousPeers = previousPeers, let peers = peers {
|
||||
if previousContacts.count >= contacts.count {
|
||||
animateChanges = true
|
||||
}
|
||||
if let previousPeers = previousPeers, let peers = peers, previousPeers.count >= peers.count {
|
||||
if previousPeers.count >= peers.count {
|
||||
animateChanges = true
|
||||
}
|
||||
}
|
||||
|
||||
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(isGroup ? presentationData.strings.Group_Members_Title : presentationData.strings.Channel_Subscribers_Title), leftNavigationButton: nil, rightNavigationButton: rightNavigationButton, secondaryRightNavigationButton: secondaryRightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
|
||||
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: channelMembersControllerEntries(context: context, presentationData: presentationData, view: view, state: state, contacts: contacts, participants: peers, isGroup: isGroup), style: .blocks, emptyStateItem: emptyStateItem, searchItem: searchItem, animateChanges: animateChanges)
|
||||
|
||||
@@ -1086,7 +1086,7 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
|
||||
}
|
||||
if let file = media as? TelegramMediaFile, !chatPresentationInterfaceState.copyProtectionEnabled && !message.isCopyProtected() {
|
||||
if file.isVideo {
|
||||
if file.isAnimated {
|
||||
if file.isAnimated && !file.isVideoSticker {
|
||||
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_LinkDialogSave, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Save"), color: theme.actionSheet.primaryTextColor)
|
||||
}, action: { _, f in
|
||||
|
||||
@@ -734,7 +734,7 @@ final class PeerChannelMemberCategoriesContext {
|
||||
let context: ChannelMemberCategoryListContext
|
||||
let emptyTimeout: Double
|
||||
switch key {
|
||||
case .admins(nil), .banned(nil), .recentSearch(nil), .restricted(nil), .restrictedAndBanned(nil), .recent:
|
||||
case .admins(nil), .banned(nil), .recentSearch(nil), .restricted(nil), .restrictedAndBanned(nil), .recent, .contacts:
|
||||
emptyTimeout = defaultEmptyTimeout
|
||||
default:
|
||||
emptyTimeout = 0.0
|
||||
|
||||
Reference in New Issue
Block a user