mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various improvements
This commit is contained in:
@@ -204,6 +204,12 @@ public class AttachmentFileControllerImpl: ItemListController, AttachmentFileCon
|
||||
private var topEdgeEffectView: EdgeEffectView?
|
||||
private var bottomEdgeEffectView: EdgeEffectView?
|
||||
|
||||
var isSearching: Bool = false {
|
||||
didSet {
|
||||
self.requestLayout(transition: .animated(duration: 0.2, curve: .easeInOut))
|
||||
}
|
||||
}
|
||||
|
||||
public override func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
super.containerLayoutUpdated(layout, transition: transition)
|
||||
|
||||
@@ -234,6 +240,7 @@ public class AttachmentFileControllerImpl: ItemListController, AttachmentFileCon
|
||||
|
||||
let bottomEdgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - edgeEffectHeight - layout.additionalInsets.bottom), size: CGSize(width: layout.size.width, height: edgeEffectHeight))
|
||||
transition.updateFrame(view: bottomEdgeEffectView, frame: bottomEdgeEffectFrame)
|
||||
transition.updateAlpha(layer: bottomEdgeEffectView.layer, alpha: self.isSearching ? 0.0 : 1.0)
|
||||
bottomEdgeEffectView.update(content: .clear, blur: true, alpha: 1.0, rect: bottomEdgeEffectFrame, edge: .bottom, edgeSize: bottomEdgeEffectFrame.height, transition: ComponentTransition(transition))
|
||||
}
|
||||
}
|
||||
@@ -255,6 +262,7 @@ public func makeAttachmentFileControllerImpl(context: AccountContext, updatedPre
|
||||
var expandImpl: (() -> Void)?
|
||||
var dismissImpl: (() -> Void)?
|
||||
var dismissInputImpl: (() -> Void)?
|
||||
var updateIsSearchingImpl: ((Bool) -> Void)?
|
||||
let arguments = AttachmentFileControllerArguments(
|
||||
context: context,
|
||||
openGallery: {
|
||||
@@ -357,6 +365,7 @@ public func makeAttachmentFileControllerImpl(context: AccountContext, updatedPre
|
||||
return updatedState
|
||||
}
|
||||
updateTabBarVisibilityImpl?(false)
|
||||
updateIsSearchingImpl?(true)
|
||||
}
|
||||
)
|
||||
let searchButtonComponent = state.searching ? nil : AnyComponentWithIdentity(id: "search", component: AnyComponent(searchButton))
|
||||
@@ -424,6 +433,7 @@ public func makeAttachmentFileControllerImpl(context: AccountContext, updatedPre
|
||||
return updatedState
|
||||
}
|
||||
updateTabBarVisibilityImpl?(true)
|
||||
updateIsSearchingImpl?(false)
|
||||
}, send: { message in
|
||||
arguments.send(message)
|
||||
}, dismissInput: {
|
||||
@@ -463,6 +473,9 @@ public func makeAttachmentFileControllerImpl(context: AccountContext, updatedPre
|
||||
return updatedState
|
||||
}
|
||||
}
|
||||
updateIsSearchingImpl = { [weak controller] isSearching in
|
||||
controller?.isSearching = isSearching
|
||||
}
|
||||
dismissImpl = { [weak controller] in
|
||||
controller?.dismiss(animated: true)
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ final class AttachmentFileEmptyStateItemNode: ItemListControllerEmptyStateItemNo
|
||||
insets.top += -60.0
|
||||
imageSize = CGSize(width: 112.0, height: 112.0)
|
||||
} else {
|
||||
insets.top += -160.0
|
||||
insets.top += 30.0 //-160.0
|
||||
}
|
||||
|
||||
let imageSpacing: CGFloat = 12.0
|
||||
|
||||
@@ -94,13 +94,15 @@ private final class AttachmentFileSearchItemNode: ItemListControllerSearchNode {
|
||||
self.strings = strings
|
||||
self.focus = focus
|
||||
self.cancel = cancel
|
||||
|
||||
|
||||
self.containerNode = AttachmentFileSearchContainerNode(context: context, forceTheme: nil, send: { message in
|
||||
send(message)
|
||||
}, updateActivity: updateActivity)
|
||||
|
||||
super.init()
|
||||
|
||||
self.addedUnderNavigationBar = true
|
||||
|
||||
self.addSubnode(self.containerNode)
|
||||
|
||||
self.containerNode.cancel = { [weak self] in
|
||||
@@ -278,6 +280,7 @@ public final class AttachmentFileSearchContainerNode: SearchDisplayControllerCon
|
||||
private let send: (Message) -> Void
|
||||
|
||||
private let dimNode: ASDisplayNode
|
||||
private let backgroundNode: ASDisplayNode
|
||||
private let listNode: ListView
|
||||
|
||||
private let emptyResultsTitleNode: ImmediateTextNode
|
||||
@@ -317,6 +320,8 @@ public final class AttachmentFileSearchContainerNode: SearchDisplayControllerCon
|
||||
self.dimNode = ASDisplayNode()
|
||||
self.dimNode.backgroundColor = .clear
|
||||
|
||||
self.backgroundNode = ASDisplayNode()
|
||||
|
||||
self.listNode = ListView()
|
||||
self.listNode.accessibilityPageScrolledString = { row, count in
|
||||
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
|
||||
@@ -336,12 +341,16 @@ public final class AttachmentFileSearchContainerNode: SearchDisplayControllerCon
|
||||
|
||||
super.init()
|
||||
|
||||
self.backgroundNode.backgroundColor = self.presentationData.theme.chatList.backgroundColor
|
||||
self.backgroundNode.alpha = 0.0
|
||||
|
||||
self.listNode.backgroundColor = self.presentationData.theme.chatList.backgroundColor
|
||||
self.listNode.alpha = 0.0
|
||||
|
||||
self._hasDim = true
|
||||
|
||||
self.addSubnode(self.dimNode)
|
||||
self.addSubnode(self.backgroundNode)
|
||||
self.addSubnode(self.listNode)
|
||||
|
||||
self.addSubnode(self.emptyResultsTitleNode)
|
||||
@@ -448,6 +457,7 @@ public final class AttachmentFileSearchContainerNode: SearchDisplayControllerCon
|
||||
}
|
||||
|
||||
private func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) {
|
||||
self.backgroundNode.backgroundColor = theme.chatList.backgroundColor
|
||||
self.listNode.backgroundColor = theme.chatList.backgroundColor
|
||||
}
|
||||
|
||||
@@ -484,6 +494,7 @@ public final class AttachmentFileSearchContainerNode: SearchDisplayControllerCon
|
||||
}
|
||||
|
||||
let containerTransition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .easeInOut)
|
||||
containerTransition.updateAlpha(node: strongSelf.backgroundNode, alpha: isSearching ? 1.0 : 0.0)
|
||||
containerTransition.updateAlpha(node: strongSelf.listNode, alpha: isSearching ? 1.0 : 0.0)
|
||||
strongSelf.dimNode.isHidden = transition.isSearching
|
||||
|
||||
@@ -514,6 +525,7 @@ public final class AttachmentFileSearchContainerNode: SearchDisplayControllerCon
|
||||
let topInset = navigationBarHeight
|
||||
transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: topInset), size: CGSize(width: layout.size.width, height: layout.size.height - topInset)))
|
||||
|
||||
self.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -66.0), size: CGSize(width: layout.size.width, height: 66.0))
|
||||
self.listNode.frame = CGRect(origin: CGPoint(), size: layout.size)
|
||||
self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: nil, updateSizeAndInsets: ListViewUpdateSizeAndInsets(size: layout.size, insets: insets, duration: duration, curve: curve), stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user