mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
9ea80ff9dc
commit
8cd037bf74
@ -2074,6 +2074,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private weak var storyTooltip: TooltipScreen?
|
||||||
fileprivate func maybeDisplayStoryTooltip() {
|
fileprivate func maybeDisplayStoryTooltip() {
|
||||||
let content = self.updateHeaderContent()
|
let content = self.updateHeaderContent()
|
||||||
if content.secondaryContent != nil {
|
if content.secondaryContent != nil {
|
||||||
@ -2128,6 +2129,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
self.present(tooltipScreen, in: .current)
|
self.present(tooltipScreen, in: .current)
|
||||||
|
self.storyTooltip = tooltipScreen
|
||||||
|
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
let _ = ApplicationSpecificNotice.setDisplayChatListStoriesTooltip(accountManager: self.context.sharedContext.accountManager).startStandalone()
|
let _ = ApplicationSpecificNotice.setDisplayChatListStoriesTooltip(accountManager: self.context.sharedContext.accountManager).startStandalone()
|
||||||
@ -4345,7 +4347,18 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
self.activateSearch(filter: filter, query: query)
|
self.activateSearch(filter: filter, query: query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var previousSearchToggleTimestamp: Double?
|
||||||
func activateSearch(filter: ChatListSearchFilter = .chats, query: String? = nil, skipScrolling: Bool = false, searchContentNode: NavigationBarSearchContentNode) {
|
func activateSearch(filter: ChatListSearchFilter = .chats, query: String? = nil, skipScrolling: Bool = false, searchContentNode: NavigationBarSearchContentNode) {
|
||||||
|
let currentTimestamp = CACurrentMediaTime()
|
||||||
|
if let previousSearchActivationTimestamp = self.previousSearchToggleTimestamp, currentTimestamp < previousSearchActivationTimestamp + 0.6 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.previousSearchToggleTimestamp = currentTimestamp
|
||||||
|
|
||||||
|
if let storyTooltip = self.storyTooltip {
|
||||||
|
storyTooltip.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
var filter = filter
|
var filter = filter
|
||||||
if case .forum = self.chatListDisplayNode.effectiveContainerNode.location {
|
if case .forum = self.chatListDisplayNode.effectiveContainerNode.location {
|
||||||
filter = .topics
|
filter = .topics
|
||||||
@ -4420,7 +4433,15 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func deactivateSearch(animated: Bool) {
|
public func deactivateSearch(animated: Bool) {
|
||||||
if !self.displayNavigationBar {
|
guard !self.displayNavigationBar else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let currentTimestamp = CACurrentMediaTime()
|
||||||
|
if let previousSearchActivationTimestamp = self.previousSearchToggleTimestamp, currentTimestamp < previousSearchActivationTimestamp + 0.6 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.previousSearchToggleTimestamp = currentTimestamp
|
||||||
|
|
||||||
var completion: (() -> Void)?
|
var completion: (() -> Void)?
|
||||||
|
|
||||||
self.searchTabsNode = nil
|
self.searchTabsNode = nil
|
||||||
@ -4463,7 +4484,6 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public func activateCompose() {
|
public func activateCompose() {
|
||||||
self.composePressed()
|
self.composePressed()
|
||||||
|
@ -20,6 +20,10 @@ private func generateHashtagIcon(color: UIColor) -> UIImage? {
|
|||||||
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Hashtag"), color: color)
|
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Hashtag"), color: color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func generateCashtagIcon(color: UIColor) -> UIImage? {
|
||||||
|
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Cashtag"), color: color)
|
||||||
|
}
|
||||||
|
|
||||||
private func generateClearIcon(color: UIColor) -> UIImage? {
|
private func generateClearIcon(color: UIColor) -> UIImage? {
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: color)
|
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Clear"), color: color)
|
||||||
}
|
}
|
||||||
@ -851,6 +855,7 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
|
|||||||
public enum Icon {
|
public enum Icon {
|
||||||
case loupe
|
case loupe
|
||||||
case hashtag
|
case hashtag
|
||||||
|
case cashtag
|
||||||
}
|
}
|
||||||
public let icon: Icon
|
public let icon: Icon
|
||||||
|
|
||||||
@ -1062,6 +1067,8 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
|
|||||||
icon = generateLoupeIcon(color: theme.inputIcon)
|
icon = generateLoupeIcon(color: theme.inputIcon)
|
||||||
case .hashtag:
|
case .hashtag:
|
||||||
icon = generateHashtagIcon(color: theme.inputIcon)
|
icon = generateHashtagIcon(color: theme.inputIcon)
|
||||||
|
case .cashtag:
|
||||||
|
icon = generateCashtagIcon(color: theme.inputIcon)
|
||||||
}
|
}
|
||||||
self.iconNode.image = icon
|
self.iconNode.image = icon
|
||||||
self.textField.keyboardAppearance = theme.keyboard.keyboardAppearance
|
self.textField.keyboardAppearance = theme.keyboard.keyboardAppearance
|
||||||
@ -1150,6 +1157,11 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
|
|||||||
}
|
}
|
||||||
self.textBackgroundNode.layer.animateFrame(from: initialTextBackgroundFrame, to: self.textBackgroundNode.frame, duration: duration, timingFunction: timingFunction)
|
self.textBackgroundNode.layer.animateFrame(from: initialTextBackgroundFrame, to: self.textBackgroundNode.frame, duration: duration, timingFunction: timingFunction)
|
||||||
|
|
||||||
|
if initialTextBackgroundFrame.height.isZero {
|
||||||
|
self.iconNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
|
||||||
|
self.textField.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
|
||||||
|
}
|
||||||
|
|
||||||
let textFieldFrame = self.textField.frame
|
let textFieldFrame = self.textField.frame
|
||||||
var tokensWidth = self.textField.tokensWidth
|
var tokensWidth = self.textField.tokensWidth
|
||||||
if tokensWidth > 0.0 {
|
if tokensWidth > 0.0 {
|
||||||
@ -1301,7 +1313,10 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate {
|
|||||||
|
|
||||||
transitionBackgroundNode.layer.animateFrame(from: self.textBackgroundNode.frame, to: targetTextBackgroundFrame, duration: duration, timingFunction: timingFunction, removeOnCompletion: false)
|
transitionBackgroundNode.layer.animateFrame(from: self.textBackgroundNode.frame, to: targetTextBackgroundFrame, duration: duration, timingFunction: timingFunction, removeOnCompletion: false)
|
||||||
|
|
||||||
if let snapshot = node.labelNode.layer.snapshotContentTree() {
|
if targetTextBackgroundFrame.height.isZero {
|
||||||
|
self.iconNode.layer.animateAlpha(from: self.iconNode.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||||
|
self.textField.layer.animateAlpha(from: self.textField.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||||
|
} else if let snapshot = node.labelNode.layer.snapshotContentTree() {
|
||||||
snapshot.frame = CGRect(origin: self.textField.placeholderLabel.frame.origin.offsetBy(dx: 0.0, dy: UIScreenPixel), size: node.labelNode.frame.size)
|
snapshot.frame = CGRect(origin: self.textField.placeholderLabel.frame.origin.offsetBy(dx: 0.0, dy: UIScreenPixel), size: node.labelNode.frame.size)
|
||||||
self.textField.layer.addSublayer(snapshot)
|
self.textField.layer.addSublayer(snapshot)
|
||||||
snapshot.animateAlpha(from: 0.0, to: 1.0, duration: duration * 2.0 / 3.0, timingFunction: CAMediaTimingFunctionName.linear.rawValue)
|
snapshot.animateAlpha(from: 0.0, to: 1.0, duration: duration * 2.0 / 3.0, timingFunction: CAMediaTimingFunctionName.linear.rawValue)
|
||||||
|
@ -268,16 +268,20 @@ public final class SearchDisplayController {
|
|||||||
searchBar?.removeFromSupernode()
|
searchBar?.removeFromSupernode()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
searchBar.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak searchBar] _ in
|
searchBar.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak searchBar] finished in
|
||||||
|
if finished {
|
||||||
searchBar?.removeFromSupernode()
|
searchBar?.removeFromSupernode()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let backgroundNode = self.backgroundNode
|
let backgroundNode = self.backgroundNode
|
||||||
let contentNode = self.contentNode
|
let contentNode = self.contentNode
|
||||||
if animated {
|
if animated {
|
||||||
backgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak backgroundNode] _ in
|
backgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, completion: { [weak backgroundNode] finished in
|
||||||
|
if finished {
|
||||||
backgroundNode?.removeFromSupernode()
|
backgroundNode?.removeFromSupernode()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
backgroundNode.removeFromSupernode()
|
backgroundNode.removeFromSupernode()
|
||||||
|
@ -727,6 +727,8 @@ public class StarsTransactionScreen: ViewControllerComponentContainer {
|
|||||||
|
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
self.present(UndoOverlayController(presentationData: presentationData, content: .copy(text: presentationData.strings.Stars_Transaction_CopiedId), elevatedLayout: false, position: .bottom, action: { _ in return true }), in: .current)
|
self.present(UndoOverlayController(presentationData: presentationData, content: .copy(text: presentationData.strings.Stars_Transaction_CopiedId), elevatedLayout: false, position: .bottom, action: { _ in return true }), in: .current)
|
||||||
|
|
||||||
|
HapticFeedback().tap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2816,8 +2816,8 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
self.skippedShowSearchResultsAsListAnimationOnce = true
|
self.skippedShowSearchResultsAsListAnimationOnce = true
|
||||||
inlineSearchResultsView.layer.allowsGroupOpacity = true
|
inlineSearchResultsView.layer.allowsGroupOpacity = true
|
||||||
if let inlineSearchResultsView = self.inlineSearchResults?.view {
|
if let emptyNode = self.emptyNode {
|
||||||
self.contentContainerNode.view.insertSubview(inlineSearchResultsView, aboveSubview: inlineSearchResultsView)
|
self.contentContainerNode.view.insertSubview(inlineSearchResultsView, aboveSubview: emptyNode.view)
|
||||||
} else {
|
} else {
|
||||||
self.contentContainerNode.view.insertSubview(inlineSearchResultsView, aboveSubview: self.historyNodeContainer.view)
|
self.contentContainerNode.view.insertSubview(inlineSearchResultsView, aboveSubview: self.historyNodeContainer.view)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user