Merge commit '8c7b94d422d93b8ee38f5bd18026a5837cf69acf'

This commit is contained in:
Ali 2021-11-25 18:34:11 +04:00
commit b60449ee0f
8 changed files with 51 additions and 9 deletions

View File

@ -7092,3 +7092,9 @@ Sorry for the inconvenience.";
"AuthSessions.AddDevice.ScanInstallInfo" = "Go to [getdesktop.telegram.org](desktop) or [web.telegram.org](web) to get the QR code";
"Channel.AdminLog.MessageSent" = "%@ sent message:";
"ChatList.ClearSearchHistory" = "Are you sure you want to clear your search history?";
"AuthSessions.TerminateSessionText" = "Are you sure you want to terminate this session?";
"Notifications.ResetAllNotificationsText" = "Are you sure you want to reset all notification settings to default?";

View File

@ -185,6 +185,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
let presentationData = strongSelf.presentationData
let actionSheet = ActionSheetController(presentationData: presentationData)
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
ActionSheetTextItem(title: presentationData.strings.ChatList_ClearSearchHistory),
ActionSheetButtonItem(title: presentationData.strings.WebSearch_RecentSectionClear, color: .destructive, action: { [weak self, weak actionSheet] in
actionSheet?.dismissAnimated()

View File

@ -1020,7 +1020,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
if let messagePeer = itemPeer.chatMainPeer {
peerText = messagePeer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder)
}
} else if let message = messages.last, case let .user(author) = message.author, let peer = itemPeer.chatMainPeer, !isUser {
} else if let message = messages.last, let author = message.author?._asPeer(), let peer = itemPeer.chatMainPeer, !isUser {
if case let .channel(peer) = peer, case .broadcast = peer.info {
} else if !displayAsMessage {
if let forwardInfo = message.forwardInfo, forwardInfo.flags.contains(.isImported), let authorSignature = forwardInfo.authorSignature {

View File

@ -64,6 +64,8 @@
[TGViewController enableAutorotation];
strongSelf->_dismissView.hidden = true;
strongSelf->_editing = false;
if (strongSelf.finishedWithCaption != nil)
strongSelf.finishedWithCaption(string);
};
@ -117,11 +119,15 @@
- (void)setCaption:(NSAttributedString *)caption
{
if (_editing)
return;
[self setCaption:caption animated:false];
}
- (void)setCaption:(NSAttributedString *)caption animated:(bool)animated
{
if (_editing)
return;
_caption = caption;
[_inputPanel setCaption:caption];
}
@ -151,6 +157,8 @@
if (gestureRecognizer.state != UIGestureRecognizerStateRecognized)
return;
_editing = false;
[self.inputPanel dismissInput];
[_dismissView removeFromSuperview];
@ -356,9 +364,14 @@
CGRect frame = _currentFrame;
UIEdgeInsets edgeInsets = _currentEdgeInsets;
CGFloat panelHeight = [_inputPanel updateLayoutSize:frame.size sideInset:0.0];
[UIView animateWithDuration:duration delay:0.0f options:curve animations:^{
[UIView animateWithDuration:duration delay:0.0f options:(curve << 16) animations:^{
_inputPanelView.frame = CGRectMake(edgeInsets.left, frame.size.height - panelHeight - MAX(edgeInsets.bottom, _keyboardHeight), frame.size.width, panelHeight);
_backgroundView.frame = CGRectMake(edgeInsets.left, frame.size.height - panelHeight - MAX(edgeInsets.bottom, _keyboardHeight), frame.size.width, MAX(panelHeight, _keyboardHeight));
CGFloat backgroundHeight = panelHeight;
if (_keyboardHeight > 0.0) {
backgroundHeight += _keyboardHeight - edgeInsets.bottom;
}
_backgroundView.frame = CGRectMake(edgeInsets.left, frame.size.height - panelHeight - MAX(edgeInsets.bottom, _keyboardHeight), frame.size.width, backgroundHeight);
} completion:nil];
if (self.keyboardHeightChanged != nil)
@ -372,7 +385,12 @@
CGFloat panelHeight = [_inputPanel updateLayoutSize:frame.size sideInset:0.0];
_inputPanelView.frame = CGRectMake(edgeInsets.left, frame.size.height - panelHeight - MAX(edgeInsets.bottom, _keyboardHeight), frame.size.width, panelHeight);
_backgroundView.frame = CGRectMake(edgeInsets.left, frame.size.height - panelHeight - MAX(edgeInsets.bottom, _keyboardHeight), frame.size.width, MAX(panelHeight, _keyboardHeight));
CGFloat backgroundHeight = panelHeight;
if (_keyboardHeight > 0.0) {
backgroundHeight += _keyboardHeight - edgeInsets.bottom;
}
_backgroundView.frame = CGRectMake(edgeInsets.left, frame.size.height - panelHeight - MAX(edgeInsets.bottom, _keyboardHeight), frame.size.width, backgroundHeight);
}
@end

View File

@ -671,6 +671,7 @@ public func notificationsAndSoundsController(context: AccountContext, exceptions
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let actionSheet = ActionSheetController(presentationData: presentationData)
actionSheet.setItemGroups([ActionSheetItemGroup(items: [
ActionSheetTextItem(title: presentationData.strings.Notifications_ResetAllNotificationsText),
ActionSheetButtonItem(title: presentationData.strings.Notifications_Reset, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()

View File

@ -609,6 +609,7 @@ public func recentSessionsController(context: AccountContext, activeSessionsCont
}
controller.setItemGroups([
ActionSheetItemGroup(items: [
ActionSheetTextItem(title: presentationData.strings.AuthSessions_TerminateSessionText),
ActionSheetButtonItem(title: presentationData.strings.AuthSessions_TerminateSession, color: .destructive, action: {
dismissAction()
completion()

View File

@ -1312,7 +1312,7 @@ final class PeerInfoHeaderSingleLineTextFieldNode: ASDisplayNode, PeerInfoHeader
}
self.backgroundNode.frame = CGRect(origin: CGPoint(x: safeInset, y: 0.0), size: CGSize(width: max(1.0, width - safeInset * 2.0), height: height))
self.textNode.frame = CGRect(origin: CGPoint(x: safeInset + 16.0, y: floor((height - 40.0) / 2.0)), size: CGSize(width: max(1.0, width - 16.0 * 2.0 - 32.0), height: 40.0))
self.textNode.frame = CGRect(origin: CGPoint(x: safeInset + 16.0, y: floor((height - 40.0) / 2.0)), size: CGSize(width: max(1.0, width - safeInset * 2.0 - 16.0 * 2.0 - 38.0), height: 40.0))
let hasCorners = safeInset > 0.0 && (!hasPrevious || !hasNext)
let hasTopCorners = hasCorners && !hasPrevious
@ -2105,14 +2105,16 @@ final class PeerInfoHeaderNode: ASDisplayNode {
let buttonKeys: [PeerInfoHeaderButtonKey] = self.isSettings ? [] : peerInfoHeaderButtons(peer: peer, cachedData: cachedData, isOpenedFromChat: self.isOpenedFromChat, isExpanded: false, videoCallsEnabled: self.videoCallsEnabled, isSecretChat: isSecretChat, isContact: isContact)
var isVerified = false
var isFake = false
let smallTitleString: NSAttributedString
let titleString: NSAttributedString
let smallSubtitleString: NSAttributedString
let subtitleString: NSAttributedString
var panelSubtitleString: NSAttributedString?
let usernameString: NSAttributedString
if let peer = peer, peer.isVerified {
isVerified = true
if let peer = peer {
isVerified = peer.isVerified
isFake = peer.isFake || peer.isScam
}
if let peer = peer {
@ -2186,7 +2188,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
let textSideInset: CGFloat = 36.0
let expandedAvatarHeight: CGFloat = expandedAvatarListSize.height
let titleConstrainedSize = CGSize(width: width - textSideInset * 2.0 - (isVerified ? 16.0 : 0.0), height: .greatestFiniteMagnitude)
let titleConstrainedSize = CGSize(width: width - textSideInset * 2.0 - (isVerified || isFake ? 20.0 : 0.0), height: .greatestFiniteMagnitude)
let titleNodeLayout = self.titleNode.updateLayout(states: [
TitleNodeStateRegular: MultiScaleTextState(attributedText: titleString, constrainedSize: titleConstrainedSize),

View File

@ -755,7 +755,20 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
self.textPlaceholderNode.isHidden = inputHasText
}
self.oneLineNode.attributedText = self.textInputNode?.attributedText
if let attributedText = self.textInputNode?.attributedText, let presentationInterfaceState = self.presentationInterfaceState {
let range = (attributedText.string as NSString).range(of: "\n")
if range.location != NSNotFound {
let textColor = presentationInterfaceState.theme.chat.inputPanel.inputTextColor
let textFont = Font.regular(max(minInputFontSize, presentationInterfaceState.fontSize.baseDisplaySize))
let trimmedText = NSMutableAttributedString(attributedString: attributedText.attributedSubstring(from: NSMakeRange(0, range.location)))
trimmedText.append(NSAttributedString(string: "\u{2026}", font: textFont, textColor: textColor))
self.oneLineNode.attributedText = trimmedText
} else {
self.oneLineNode.attributedText = attributedText
}
} else {
self.oneLineNode.attributedText = nil
}
self.updateTextHeight(animated: animated)
}