Merge commit 'c9244404020e6b537f83b26f9efcacba3247cb0d'

This commit is contained in:
Ali 2021-08-01 18:12:57 +02:00
commit 1a0dc56953
2 changed files with 20 additions and 3 deletions

View File

@ -1414,7 +1414,8 @@ const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f;
- (CGFloat)_brushWeightForSize:(CGFloat)size
{
return ([self _brushBaseWeightForCurrentPainting] + [self _brushWeightRangeForCurrentPainting] * size) / _scrollView.zoomScale;
CGFloat scale = MAX(0.001, _scrollView.zoomScale);
return ([self _brushBaseWeightForCurrentPainting] + [self _brushWeightRangeForCurrentPainting] * size) / scale;
}
+ (CGSize)maximumPaintingSize

View File

@ -442,6 +442,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return self.chatLocation
}
private var scheduledScrollToMessageId: (MessageId, Double?)?
public var purposefulAction: (() -> Void)?
var updatedClosedPinnedMessageId: ((MessageId) -> Void)?
var requestedUnpinAllMessages: ((Int, MessageId) -> Void)?
@ -2425,7 +2427,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
if !found {
let _ = strongSelf.controllerInteraction?.openMessage(message, .timecode(Double(timestamp)))
if let _ = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(message.id) {
let _ = strongSelf.controllerInteraction?.openMessage(message, .timecode(Double(timestamp)))
} else {
strongSelf.navigateToMessage(messageLocation: .id(message.id, Double(timestamp)), animated: true, forceInCurrentChat: true)
}
}
}
}, scheduleCurrentMessage: { [weak self] in
@ -4632,7 +4638,14 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}))
if case let .message(_, _, maybeTimecode) = strongSelf.subject, let timecode = maybeTimecode, initial {
if let (messageId, maybeTimecode) = strongSelf.scheduledScrollToMessageId {
strongSelf.scheduledScrollToMessageId = nil
if let timecode = maybeTimecode, message.id == messageId {
Queue.mainQueue().after(0.2) {
let _ = strongSelf.controllerInteraction?.openMessage(message, .timecode(timecode))
}
}
} else if case let .message(_, _, maybeTimecode) = strongSelf.subject, let timecode = maybeTimecode, initial {
Queue.mainQueue().after(0.2) {
let _ = strongSelf.controllerInteraction?.openMessage(message, .timecode(timecode))
}
@ -10781,6 +10794,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} else if case let .index(index) = messageLocation, index.id.id == 0, index.timestamp > 0, case .scheduledMessages = self.presentationInterfaceState.subject {
self.chatDisplayNode.historyNode.scrollToMessage(from: scrollFromIndex, to: index, animated: animated, scrollPosition: scrollPosition)
} else {
if case let .id(messageId, maybeTimecode) = messageLocation, let timecode = maybeTimecode {
self.scheduledScrollToMessageId = (messageId, timecode)
}
self.loadingMessage.set(.single(statusSubject) |> delay(0.1, queue: .mainQueue()))
let searchLocation: ChatHistoryInitialSearchLocation
switch messageLocation {