Skip to content

Commit

Permalink
Cherry-pick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
laktyushin committed Mar 7, 2024
1 parent d41b2d9 commit fba37dc
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ - (void)setItem:(TGMediaPickerGalleryPhotoItem *)item synchronously:(bool)synchr

}]];

if (!item.asFile) {
[_facesDisposable setDisposable:[[TGPaintFaceDetector detectFacesInItem:item.editableMediaItem editingContext:item.editingContext] startStrictWithNext:nil file:__FILE_NAME__ line:__LINE__]];

return;
}
// if (!item.asFile) {
// [_facesDisposable setDisposable:[[TGPaintFaceDetector detectFacesInItem:item.editableMediaItem editingContext:item.editingContext] startStrictWithNext:nil file:__FILE_NAME__ line:__LINE__]];
//
// return;
// }

_fileInfoLabel.text = nil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public final class PeerNameColorItemNode: ListViewItemNode, ItemListItemNode {

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)

let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
Expand Down Expand Up @@ -518,6 +518,7 @@ public final class PeerNameColorItemNode: ListViewItemNode, ItemListItemNode {
var origin = CGPoint(x: sideInset, y: 10.0)

i = 0
var validIds = Set<Int32>()
for item in items {
let iconItemNode: PeerNameColorIconItemNode
let indexKey: Int32
Expand Down Expand Up @@ -545,6 +546,20 @@ public final class PeerNameColorItemNode: ListViewItemNode, ItemListItemNode {
origin.x = sideInset
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()
}
}
}
})
Expand Down
13 changes: 1 addition & 12 deletions submodules/TelegramUI/Sources/ChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -714,11 +714,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if strongSelf.presentVoiceMessageDiscardAlert(action: action, performAction: false) {
return false
}

if strongSelf.presentRecordedVoiceMessageDiscardAlert(action: action, performAction: false) {
return false
}


if case let .customChatContents(customChatContents) = strongSelf.presentationInterfaceState.subject {
switch customChatContents.kind {
case let .quickReplyMessageInput(_, shortcutType):
Expand Down Expand Up @@ -14471,13 +14467,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
frames: data.frames,
framesUpdateTimestamp: data.framesUpdateTimestamp,
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
Expand Down
4 changes: 1 addition & 3 deletions submodules/TelegramUI/Sources/NavigateToChatController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ public func navigateToChatControllerImpl(_ params: NavigateToChatControllerParam
controller.presentThemeSelection()
}
if let botStart = params.botStart {
controller.updateChatPresentationInterfaceState(interactive: false, { state -> ChatPresentationInterfaceState in
return state.updatedBotStartPayload(botStart.payload)
})
controller.startBot(botStart.payload)
}
if let attachBotStart = params.attachBotStart {
controller.presentAttachmentBot(botId: attachBotStart.botId, payload: attachBotStart.payload, justInstalled: attachBotStart.justInstalled)
Expand Down
13 changes: 11 additions & 2 deletions submodules/TelegramUI/Sources/OpenResolvedUrl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import AuthorizationUI
import ChatFolderLinkPreviewScreen
import StoryContainerScreen
import WallpaperGalleryScreen
import TelegramStringFormatting

private func defaultNavigationForPeerId(_ peerId: PeerId?, navigation: ChatControllerInteractionNavigateToPeer) -> ChatControllerInteractionNavigateToPeer {
if case .default = navigation {
Expand Down Expand Up @@ -986,7 +987,15 @@ func openResolvedUrlImpl(
forceDark: forceDark,
action: { [weak navigationController] in
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?()

let controller = PremiumIntroScreen(context: context, source: .settings, forceDark: forceDark, forceHasPremium: true)
Expand Down Expand Up @@ -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))

let _ = (enqueueMessages(account: context.account, peerId: peer.id, messages: messages)
|> deliverOnMainQueue).startStandalone()
|> deliverOnMainQueue).startStandalone()
if let peerSelectionController = peerSelectionController {
peerSelectionController.dismiss()
}
Expand Down
1 change: 1 addition & 0 deletions submodules/WebPBinding/Sources/UIImage+WebP.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ + (NSData * _Nullable)convertToWebP:(UIImage * _Nonnull)image quality:(CGFloat)q
CGContextRef context = CGBitmapContextCreate(rawData, width, height, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
CGColorSpaceRelease(colorSpace);

CGContextClearRect(context, CGRectMake(0, 0, width, height));
CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef);
CGContextRelease(context);

Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"app": "10.9.1",
"app": "10.9.2",
"bazel": "7.0.2",
"xcode": "15.2",
"macos": "13.0"
Expand Down

0 comments on commit fba37dc

Please sign in to comment.