Various fixes

This commit is contained in:
Ilya Laktyushin 2024-03-07 18:06:19 +04:00
parent 8007e25fc4
commit 4bb4e6e896
5 changed files with 34 additions and 20 deletions

View File

@ -248,11 +248,11 @@
}]]; }]];
if (!item.asFile) { // if (!item.asFile) {
[_facesDisposable setDisposable:[[TGPaintFaceDetector detectFacesInItem:item.editableMediaItem editingContext:item.editingContext] startStrictWithNext:nil file:__FILE_NAME__ line:__LINE__]]; // [_facesDisposable setDisposable:[[TGPaintFaceDetector detectFacesInItem:item.editableMediaItem editingContext:item.editingContext] startStrictWithNext:nil file:__FILE_NAME__ line:__LINE__]];
//
return; // return;
} // }
_fileInfoLabel.text = nil; _fileInfoLabel.text = nil;

View File

@ -407,7 +407,7 @@ public final class PeerNameColorItemNode: ListViewItemNode, ItemListItemNode {
let rowsCount = ceil(CGFloat(numItems) / CGFloat(itemsPerRow)) let rowsCount = ceil(CGFloat(numItems) / CGFloat(itemsPerRow))
contentSize = CGSize(width: params.width, height: 48.0 * rowsCount) contentSize = CGSize(width: params.width, height: 10.0 + 42.0 * rowsCount)
insets = itemListNeighborsGroupedInsets(neighbors, params) insets = itemListNeighborsGroupedInsets(neighbors, params)
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets) let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
@ -518,6 +518,7 @@ public final class PeerNameColorItemNode: ListViewItemNode, ItemListItemNode {
var origin = CGPoint(x: sideInset, y: 10.0) var origin = CGPoint(x: sideInset, y: 10.0)
i = 0 i = 0
var validIds = Set<Int32>()
for item in items { for item in items {
let iconItemNode: PeerNameColorIconItemNode let iconItemNode: PeerNameColorIconItemNode
let indexKey: Int32 let indexKey: Int32
@ -545,6 +546,20 @@ public final class PeerNameColorItemNode: ListViewItemNode, ItemListItemNode {
origin.x = sideInset origin.x = sideInset
origin.y += iconSize.height + 10.0 origin.y += iconSize.height + 10.0
} }
validIds.insert(indexKey)
}
var removeKeys: [Int32] = []
for (id, _) in strongSelf.itemNodes {
if !validIds.contains(id) {
removeKeys.append(id)
}
}
for id in removeKeys {
if let itemNode = strongSelf.itemNodes.removeValue(forKey: id) {
itemNode.removeFromSupernode()
}
} }
} }
}) })

View File

@ -714,11 +714,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if strongSelf.presentVoiceMessageDiscardAlert(action: action, performAction: false) { if strongSelf.presentVoiceMessageDiscardAlert(action: action, performAction: false) {
return false return false
} }
if strongSelf.presentRecordedVoiceMessageDiscardAlert(action: action, performAction: false) {
return false
}
if case let .customChatContents(customChatContents) = strongSelf.presentationInterfaceState.subject { if case let .customChatContents(customChatContents) = strongSelf.presentationInterfaceState.subject {
switch customChatContents.kind { switch customChatContents.kind {
case let .quickReplyMessageInput(_, shortcutType): case let .quickReplyMessageInput(_, shortcutType):
@ -14462,13 +14458,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
frames: data.frames, frames: data.frames,
framesUpdateTimestamp: data.framesUpdateTimestamp, framesUpdateTimestamp: data.framesUpdateTimestamp,
trimRange: data.trimRange trimRange: data.trimRange
// control: ChatRecordedMediaPreview.Video.Control(
// updateTrimRange: { [weak self] start, end, updatedEnd, apply in
// if let self, let videoRecorderValue = self.videoRecorderValue {
// videoRecorderValue.updateTrimRange(start: start, end: end, updatedEnd: updatedEnd, apply: apply)
// }
// }
// )
) )
)) ))
}.updatedInputTextPanelState { panelState in }.updatedInputTextPanelState { panelState in

View File

@ -32,6 +32,7 @@ import AuthorizationUI
import ChatFolderLinkPreviewScreen import ChatFolderLinkPreviewScreen
import StoryContainerScreen import StoryContainerScreen
import WallpaperGalleryScreen import WallpaperGalleryScreen
import TelegramStringFormatting
private func defaultNavigationForPeerId(_ peerId: PeerId?, navigation: ChatControllerInteractionNavigateToPeer) -> ChatControllerInteractionNavigateToPeer { private func defaultNavigationForPeerId(_ peerId: PeerId?, navigation: ChatControllerInteractionNavigateToPeer) -> ChatControllerInteractionNavigateToPeer {
if case .default = navigation { if case .default = navigation {
@ -986,7 +987,15 @@ func openResolvedUrlImpl(
forceDark: forceDark, forceDark: forceDark,
action: { [weak navigationController] in action: { [weak navigationController] in
let _ = (context.engine.payments.applyPremiumGiftCode(slug: slug) let _ = (context.engine.payments.applyPremiumGiftCode(slug: slug)
|> deliverOnMainQueue).startStandalone(completed: { |> deliverOnMainQueue).startStandalone(error: { error in
dismissImpl?()
if case let .waitForExpiration(date) = error {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let dateText = stringForMediumDate(timestamp: date, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat)
(navigationController?.topViewController as? ViewController)?.present(UndoOverlayController(presentationData: presentationData, content: .info(title: presentationData.strings.Premium_Gift_ApplyLink_AlreadyHasPremium_Title, text: presentationData.strings.Premium_Gift_ApplyLink_AlreadyHasPremium_Text(dateText).string, timeout: nil, customUndoText: nil), elevatedLayout: true, position: .bottom, action: { _ in return true }), in: .window(.root))
}
}, completed: {
dismissImpl?() dismissImpl?()
let controller = PremiumIntroScreen(context: context, source: .settings, forceDark: forceDark, forceHasPremium: true) let controller = PremiumIntroScreen(context: context, source: .settings, forceDark: forceDark, forceHasPremium: true)
@ -1030,7 +1039,7 @@ func openResolvedUrlImpl(
(navigationController?.topViewController as? ViewController)?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: true, text: peer.id == context.account.peerId ? presentationData.strings.GiftLink_LinkSharedToSavedMessages : presentationData.strings.GiftLink_LinkSharedToChat(peer.compactDisplayTitle).string), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), in: .window(.root)) (navigationController?.topViewController as? ViewController)?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: true, text: peer.id == context.account.peerId ? presentationData.strings.GiftLink_LinkSharedToSavedMessages : presentationData.strings.GiftLink_LinkSharedToChat(peer.compactDisplayTitle).string), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), in: .window(.root))
let _ = (enqueueMessages(account: context.account, peerId: peer.id, messages: messages) let _ = (enqueueMessages(account: context.account, peerId: peer.id, messages: messages)
|> deliverOnMainQueue).startStandalone() |> deliverOnMainQueue).startStandalone()
if let peerSelectionController = peerSelectionController { if let peerSelectionController = peerSelectionController {
peerSelectionController.dismiss() peerSelectionController.dismiss()
} }

View File

@ -87,6 +87,7 @@
CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace); CGColorSpaceRelease(colorSpace);
CGContextClearRect(context, CGRectMake(0, 0, width, height));
CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef); CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef);
CGContextRelease(context); CGContextRelease(context);