mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Cherry-pick more fixes
This commit is contained in:
parent
4f325b354f
commit
5d97a0c65c
@ -7131,3 +7131,5 @@ Sorry for the inconvenience.";
|
||||
"Conversation.LargeEmojiDisabledInfo" = "You have disabled large emoji, so they appear small and have no effects in chat.";
|
||||
"Conversation.LargeEmojiEnable" = "Enable Large Emoji";
|
||||
"Conversation.LargeEmojiEnabled" = "Large emoji enabled.";
|
||||
|
||||
"ChatList.Archive" = "Archive";
|
||||
|
@ -31,6 +31,7 @@ import UndoUI
|
||||
import TextFormat
|
||||
|
||||
private enum ChatListTokenId: Int32 {
|
||||
case archive
|
||||
case filter
|
||||
case peer
|
||||
case date
|
||||
@ -457,13 +458,17 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
|
||||
private func updateSearchOptions(_ options: ChatListSearchOptions?, clearQuery: Bool = false) {
|
||||
var options = options
|
||||
var tokens: [SearchBarToken] = []
|
||||
if self.groupId == .archive {
|
||||
tokens.append(SearchBarToken(id: ChatListTokenId.archive.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Archive"), title: self.presentationData.strings.ChatList_Archive, permanent: true))
|
||||
}
|
||||
|
||||
if options?.isEmpty ?? true {
|
||||
options = nil
|
||||
}
|
||||
self.searchOptionsValue = options
|
||||
self.searchOptions.set(.single(options))
|
||||
|
||||
var tokens: [SearchBarToken] = []
|
||||
if let (peerId, isGroup, peerName) = options?.peer {
|
||||
let image: UIImage?
|
||||
if isGroup {
|
||||
@ -473,11 +478,11 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
} else {
|
||||
image = UIImage(bundleImageName: "Chat List/Search/User")
|
||||
}
|
||||
tokens.append(SearchBarToken(id: ChatListTokenId.peer.rawValue, icon:image, title: peerName))
|
||||
tokens.append(SearchBarToken(id: ChatListTokenId.peer.rawValue, icon: image, title: peerName, permanent: false))
|
||||
}
|
||||
|
||||
if let (_, _, dateTitle) = options?.date {
|
||||
tokens.append(SearchBarToken(id: ChatListTokenId.date.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Calendar"), title: dateTitle))
|
||||
tokens.append(SearchBarToken(id: ChatListTokenId.date.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Calendar"), title: dateTitle, permanent: false))
|
||||
|
||||
self.suggestedDates.set(.single([]))
|
||||
}
|
||||
@ -524,7 +529,12 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
||||
self.paneContainerNode.requestSelectPane(key)
|
||||
self.updateSearchOptions(nil)
|
||||
self.searchTextUpdated(text: query ?? "")
|
||||
self.setQuery?(nil, [], query ?? "")
|
||||
|
||||
var tokens: [SearchBarToken] = []
|
||||
if self.groupId == .archive {
|
||||
tokens.append(SearchBarToken(id: ChatListTokenId.archive.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Archive"), title: self.presentationData.strings.ChatList_Archive, permanent: true))
|
||||
}
|
||||
self.setQuery?(nil, tokens, query ?? "")
|
||||
}
|
||||
|
||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
|
@ -322,8 +322,10 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
strongSelf.recognizedContentNode?.removeFromSupernode()
|
||||
if !results.isEmpty {
|
||||
let size = strongSelf.imageNode.bounds.size
|
||||
let recognizedContentNode = RecognizedContentContainer(size: size, recognitions: results, presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, present: { c, a in
|
||||
strongSelf.galleryController()?.presentInGlobalOverlay(c, with: a)
|
||||
let recognizedContentNode = RecognizedContentContainer(size: size, recognitions: results, presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, present: { [weak self] c, a in
|
||||
if let strongSelf = self {
|
||||
strongSelf.galleryController()?.presentInGlobalOverlay(c, with: a)
|
||||
}
|
||||
}, performAction: { [weak self] string, action in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
|
@ -302,6 +302,7 @@ private func recognizeContent(in image: UIImage) -> Signal<[RecognizedContent],
|
||||
let _ = barcodeResult.swap(mappedResults)
|
||||
completion()
|
||||
}
|
||||
barcodeRequest.preferBackgroundProcessing = true
|
||||
requests.append(barcodeRequest)
|
||||
|
||||
if #available(iOS 13.0, *) {
|
||||
@ -310,6 +311,7 @@ private func recognizeContent(in image: UIImage) -> Signal<[RecognizedContent],
|
||||
let _ = textResult.swap(mappedResults)
|
||||
completion()
|
||||
}
|
||||
textRequest.preferBackgroundProcessing = true
|
||||
textRequest.usesLanguageCorrection = true
|
||||
requests.append(textRequest)
|
||||
} else {
|
||||
@ -320,7 +322,11 @@ private func recognizeContent(in image: UIImage) -> Signal<[RecognizedContent],
|
||||
try? handler.perform(requests)
|
||||
|
||||
return ActionDisposable {
|
||||
|
||||
if #available(iOS 13.0, *) {
|
||||
for request in requests {
|
||||
request.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -43,12 +43,14 @@ public struct SearchBarToken {
|
||||
public let icon: UIImage?
|
||||
public let title: String
|
||||
public let style: Style?
|
||||
public let permanent: Bool
|
||||
|
||||
public init(id: AnyHashable, icon: UIImage?, title: String, style: Style? = nil) {
|
||||
public init(id: AnyHashable, icon: UIImage?, title: String, style: Style? = nil, permanent: Bool) {
|
||||
self.id = id
|
||||
self.icon = icon
|
||||
self.title = title
|
||||
self.style = style
|
||||
self.permanent = permanent
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +108,7 @@ private final class TokenNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
@objc private func tapGesture() {
|
||||
|
||||
self.tapped?()
|
||||
}
|
||||
|
||||
@ -264,7 +267,7 @@ private class SearchBarTextField: UITextField, UIScrollViewDelegate {
|
||||
if i < self.tokens.count - 1 && isSelected {
|
||||
hasSelected = true
|
||||
}
|
||||
let isCollapsed = !isSelected && (i < self.tokens.count - 1 || hasSelected)
|
||||
let isCollapsed = !isSelected && (token.permanent || (i < self.tokens.count - 1 || hasSelected))
|
||||
tokenNode.update(theme: self.theme, token: token, isSelected: isSelected, isCollapsed: isCollapsed)
|
||||
}
|
||||
var removeKeys: [AnyHashable] = []
|
||||
@ -863,8 +866,10 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
|
||||
return false
|
||||
}
|
||||
if let index = strongSelf.textField.selectedTokenIndex {
|
||||
strongSelf.tokens.remove(at: index)
|
||||
strongSelf.tokensUpdated?(strongSelf.tokens)
|
||||
if !strongSelf.tokens[index].permanent {
|
||||
strongSelf.tokens.remove(at: index)
|
||||
strongSelf.tokensUpdated?(strongSelf.tokens)
|
||||
}
|
||||
return true
|
||||
} else if strongSelf.text.isEmpty {
|
||||
strongSelf.clearPressed()
|
||||
|
@ -70,15 +70,18 @@ public final class SearchDisplayController {
|
||||
self.contentNode.dismissInput = { [weak self] in
|
||||
self?.searchBar.deactivate(clear: false)
|
||||
}
|
||||
|
||||
var isFirstTime = true
|
||||
self.contentNode.setQuery = { [weak self] prefix, tokens, query in
|
||||
if let strongSelf = self {
|
||||
strongSelf.searchBar.prefixString = prefix
|
||||
let previousTokens = strongSelf.searchBar.tokens
|
||||
strongSelf.searchBar.tokens = tokens
|
||||
strongSelf.searchBar.text = query
|
||||
if previousTokens.count < tokens.count {
|
||||
if previousTokens.count < tokens.count && !isFirstTime {
|
||||
strongSelf.searchBar.selectLastToken()
|
||||
}
|
||||
isFirstTime = false
|
||||
}
|
||||
}
|
||||
if let placeholder = placeholder {
|
||||
|
@ -681,7 +681,7 @@ final class ThemeGridSearchContentNode: SearchDisplayControllerContentNode {
|
||||
foregroundColor = .white
|
||||
strokeColor = color.displayColor
|
||||
}
|
||||
tokens = [SearchBarToken(id: 0, icon: UIImage(bundleImageName: "Settings/WallpaperSearchColorIcon"), title: color.localizedString(strings: self.presentationData.strings), style: SearchBarToken.Style(backgroundColor: backgroundColor, foregroundColor: foregroundColor, strokeColor: strokeColor))]
|
||||
tokens = [SearchBarToken(id: 0, icon: UIImage(bundleImageName: "Settings/WallpaperSearchColorIcon"), title: color.localizedString(strings: self.presentationData.strings), style: SearchBarToken.Style(backgroundColor: backgroundColor, foregroundColor: foregroundColor, strokeColor: strokeColor), permanent: false)]
|
||||
text = query
|
||||
placeholder = self.presentationData.strings.Wallpaper_SearchShort
|
||||
}
|
||||
|
12
submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "archive_18.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
109
submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/archive_18.pdf
vendored
Normal file
109
submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/archive_18.pdf
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
%PDF-1.7
|
||||
|
||||
1 0 obj
|
||||
<< >>
|
||||
endobj
|
||||
|
||||
2 0 obj
|
||||
<< /Length 3 0 R >>
|
||||
stream
|
||||
/DeviceRGB CS
|
||||
/DeviceRGB cs
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 3.000000 11.625000 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
0.000000 1.500000 m
|
||||
0.000000 1.848739 -0.000000 2.023109 0.038333 2.166172 c
|
||||
0.142359 2.554400 0.445600 2.857641 0.833829 2.961667 c
|
||||
0.976891 3.000000 1.151261 3.000000 1.500000 3.000000 c
|
||||
10.500000 3.000000 l
|
||||
10.848740 3.000000 11.023109 3.000000 11.166171 2.961667 c
|
||||
11.554400 2.857641 11.857641 2.554400 11.961666 2.166172 c
|
||||
12.000000 2.023109 12.000000 1.848739 12.000000 1.500000 c
|
||||
12.000000 1.500000 l
|
||||
12.000000 1.151261 12.000000 0.976891 11.961666 0.833829 c
|
||||
11.857641 0.445600 11.554400 0.142359 11.166171 0.038333 c
|
||||
11.023109 0.000000 10.848740 0.000000 10.500000 0.000000 c
|
||||
1.500000 0.000000 l
|
||||
1.151261 0.000000 0.976891 0.000000 0.833829 0.038333 c
|
||||
0.445600 0.142359 0.142359 0.445600 0.038333 0.833829 c
|
||||
-0.000000 0.976891 0.000000 1.151261 0.000000 1.500000 c
|
||||
0.000000 1.500000 l
|
||||
h
|
||||
f
|
||||
n
|
||||
Q
|
||||
q
|
||||
1.000000 0.000000 -0.000000 1.000000 3.750000 3.375000 cm
|
||||
0.000000 0.000000 0.000000 scn
|
||||
0.000000 3.200033 m
|
||||
0.000000 7.625000 l
|
||||
10.500000 7.625000 l
|
||||
10.500000 3.200035 l
|
||||
10.500000 2.079930 10.500000 1.519877 10.282013 1.092054 c
|
||||
10.090266 0.715730 9.784306 0.409769 9.407981 0.218022 c
|
||||
8.980158 0.000035 8.420105 0.000035 7.300000 0.000035 c
|
||||
3.200000 0.000035 l
|
||||
2.079895 0.000035 1.519843 0.000035 1.092019 0.218022 c
|
||||
0.715695 0.409769 0.409734 0.715730 0.217987 1.092054 c
|
||||
0.000000 1.519877 0.000000 2.079929 0.000000 3.200033 c
|
||||
h
|
||||
3.000000 6.500000 m
|
||||
2.723858 6.500000 2.500000 6.276142 2.500000 6.000000 c
|
||||
2.500000 5.723858 2.723858 5.500000 3.000000 5.500000 c
|
||||
7.500000 5.500000 l
|
||||
7.776143 5.500000 8.000000 5.723858 8.000000 6.000000 c
|
||||
8.000000 6.276142 7.776143 6.500000 7.500000 6.500000 c
|
||||
3.000000 6.500000 l
|
||||
h
|
||||
f*
|
||||
n
|
||||
Q
|
||||
|
||||
endstream
|
||||
endobj
|
||||
|
||||
3 0 obj
|
||||
1750
|
||||
endobj
|
||||
|
||||
4 0 obj
|
||||
<< /Annots []
|
||||
/Type /Page
|
||||
/MediaBox [ 0.000000 0.000000 18.000000 18.000000 ]
|
||||
/Resources 1 0 R
|
||||
/Contents 2 0 R
|
||||
/Parent 5 0 R
|
||||
>>
|
||||
endobj
|
||||
|
||||
5 0 obj
|
||||
<< /Kids [ 4 0 R ]
|
||||
/Count 1
|
||||
/Type /Pages
|
||||
>>
|
||||
endobj
|
||||
|
||||
6 0 obj
|
||||
<< /Pages 5 0 R
|
||||
/Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
|
||||
xref
|
||||
0 7
|
||||
0000000000 65535 f
|
||||
0000000010 00000 n
|
||||
0000000034 00000 n
|
||||
0000001840 00000 n
|
||||
0000001863 00000 n
|
||||
0000002036 00000 n
|
||||
0000002110 00000 n
|
||||
trailer
|
||||
<< /ID [ (some) (id) ]
|
||||
/Root 6 0 R
|
||||
/Size 7
|
||||
>>
|
||||
startxref
|
||||
2169
|
||||
%%EOF
|
@ -4859,6 +4859,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
allPeers?.insert(currentAccountPeer, at: 0)
|
||||
}
|
||||
}
|
||||
if allPeers?.count == 1 {
|
||||
allPeers = nil
|
||||
}
|
||||
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: false, {
|
||||
return $0.updatedSendAsPeers(allPeers)
|
||||
})
|
||||
|
@ -132,6 +132,9 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
||||
}
|
||||
|
||||
@objc func forwardButtonPressed() {
|
||||
if let _ = self.presentationInterfaceState?.renderedPeer?.peer as? TelegramSecretChat {
|
||||
return
|
||||
}
|
||||
if let actions = self.actions, actions.isCopyProtected {
|
||||
self.interfaceInteraction?.displayCopyProtectionTip(self.forwardButton, false)
|
||||
} else {
|
||||
@ -140,6 +143,9 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
||||
}
|
||||
|
||||
@objc func shareButtonPressed() {
|
||||
if let _ = self.presentationInterfaceState?.renderedPeer?.peer as? TelegramSecretChat {
|
||||
return
|
||||
}
|
||||
if let actions = self.actions, actions.isCopyProtected {
|
||||
self.interfaceInteraction?.displayCopyProtectionTip(self.shareButton, true)
|
||||
} else {
|
||||
|
@ -112,7 +112,7 @@ final class ChatSearchNavigationContentNode: NavigationBarContentNode {
|
||||
self.searchBar.prefixString = NSAttributedString(string: strings.Conversation_SearchByName_Prefix, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputTextColor)
|
||||
self.searchBar.placeholderString = nil
|
||||
case let .member(peer):
|
||||
self.searchBar.tokens = [SearchBarToken(id: peer.id, icon: UIImage(bundleImageName: "Chat List/Search/User"), title: EnginePeer(peer).compactDisplayTitle)]
|
||||
self.searchBar.tokens = [SearchBarToken(id: peer.id, icon: UIImage(bundleImageName: "Chat List/Search/User"), title: EnginePeer(peer).compactDisplayTitle, permanent: false)]
|
||||
self.searchBar.prefixString = nil
|
||||
self.searchBar.placeholderString = nil
|
||||
}
|
||||
|
@ -6424,7 +6424,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
}
|
||||
strongSelf.deleteMessages(messageIds: nil)
|
||||
}, shareMessages: { [weak self] in
|
||||
guard let strongSelf = self, let messageIds = strongSelf.state.selectedMessageIds, !messageIds.isEmpty else {
|
||||
guard let strongSelf = self, let messageIds = strongSelf.state.selectedMessageIds, !messageIds.isEmpty, strongSelf.peerId.namespace != Namespaces.Peer.SecretChat else {
|
||||
return
|
||||
}
|
||||
let _ = (strongSelf.context.account.postbox.transaction { transaction -> [Message] in
|
||||
@ -6448,7 +6448,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
}
|
||||
})
|
||||
}, forwardMessages: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
guard let strongSelf = self, strongSelf.peerId.namespace != Namespaces.Peer.SecretChat else {
|
||||
return
|
||||
}
|
||||
strongSelf.forwardMessages(messageIds: nil)
|
||||
|
@ -114,7 +114,7 @@ final class MessageMediaPlaylistItem: SharedMediaPlaylistItem {
|
||||
albumArt = SharedMediaPlaybackAlbumArt(thumbnailResource: ExternalMusicAlbumArtResource(title: updatedTitle ?? "", performer: updatedPerformer ?? "", isThumbnail: true), fullSizeResource: ExternalMusicAlbumArtResource(title: updatedTitle ?? "", performer: updatedPerformer ?? "", isThumbnail: false))
|
||||
}
|
||||
|
||||
return SharedMediaPlaybackDisplayData.music(title: updatedTitle, performer: updatedPerformer, albumArt: albumArt, long: duration > 60 * 20)
|
||||
return SharedMediaPlaybackDisplayData.music(title: updatedTitle, performer: updatedPerformer, albumArt: albumArt, long: CGFloat(duration) > 10.0 * 60.0)
|
||||
}
|
||||
case let .Video(_, _, flags):
|
||||
if flags.contains(.instantRoundVideo) {
|
||||
|
@ -528,7 +528,7 @@ class StickerPaneTrendingListGridItemNode: GridItemNode {
|
||||
|
||||
let titleFrame = CGRect(origin: CGPoint(x: params.leftInset + leftInset, y: topOffset), size: titleLayout.size)
|
||||
let dismissButtonSize = CGSize(width: 12.0, height: 12.0)
|
||||
self.dismissButtonNode.frame = CGRect(origin: CGPoint(x: params.width - params.rightInset - rightInset - dismissButtonSize.width, y: topOffset - 1.0), size: dismissButtonSize)
|
||||
self.dismissButtonNode.frame = CGRect(origin: CGPoint(x: params.width - params.rightInset - rightInset - dismissButtonSize.width + 1.0, y: topOffset - 1.0), size: dismissButtonSize)
|
||||
self.dismissButtonNode.isHidden = item.dismiss == nil
|
||||
self.titleNode.frame = titleFrame
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user