mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Various improvements
This commit is contained in:
@@ -595,7 +595,7 @@ public class AttachmentController: ViewController, MinimizableController {
|
||||
strongSelf.controller?.minimizedBounds = bounds
|
||||
|
||||
if !strongSelf.isMinimizing {
|
||||
if controller.style != .glass {
|
||||
if controller.style != .glass || strongSelf.didMaximizeOnce {
|
||||
strongSelf.controller?.updateModalStyleOverlayTransitionFactor(progress, transition: transition)
|
||||
}
|
||||
strongSelf.containerLayoutUpdated(layout, transition: transition)
|
||||
@@ -623,6 +623,7 @@ public class AttachmentController: ViewController, MinimizableController {
|
||||
self.minimize(damping: damping, initialVelocity: initialVelocity)
|
||||
return false
|
||||
} else {
|
||||
controller.willDismiss()
|
||||
self.animateOut(damping: damping, initialVelocity: initialVelocity, completion: {
|
||||
self.controller?.dismiss(animated: false)
|
||||
})
|
||||
@@ -822,12 +823,14 @@ public class AttachmentController: ViewController, MinimizableController {
|
||||
}
|
||||
}
|
||||
|
||||
private var didMaximizeOnce = false
|
||||
fileprivate func minimize(damping: CGFloat? = nil, initialVelocity: CGFloat? = nil) {
|
||||
guard let controller = self.controller, let navigationController = controller.navigationController as? NavigationController else {
|
||||
return
|
||||
}
|
||||
navigationController.minimizeViewController(controller, damping: damping, velocity: initialVelocity, beforeMaximize: { navigationController, completion in
|
||||
controller.mainController.beforeMaximize(navigationController: navigationController, completion: completion)
|
||||
navigationController.minimizeViewController(controller, damping: damping, velocity: initialVelocity, beforeMaximize: { [weak self, weak controller] navigationController, completion in
|
||||
self?.didMaximizeOnce = true
|
||||
controller?.mainController.beforeMaximize(navigationController: navigationController, completion: completion)
|
||||
}, setupContainer: { [weak self] current in
|
||||
let minimizedContainer: MinimizedContainerImpl?
|
||||
if let current = current as? MinimizedContainerImpl {
|
||||
@@ -1228,7 +1231,7 @@ public class AttachmentController: ViewController, MinimizableController {
|
||||
self?.isAnimating = false
|
||||
})
|
||||
|
||||
if controller.style != .glass {
|
||||
if controller.style != .glass || self.didMaximizeOnce {
|
||||
self.controller?.updateModalStyleOverlayTransitionFactor(0.0, transition: positionTransition)
|
||||
}
|
||||
|
||||
@@ -1293,7 +1296,8 @@ public class AttachmentController: ViewController, MinimizableController {
|
||||
self.wrapperNode.view.mask = nil
|
||||
self.shadowNode.alpha = 0.0
|
||||
} else {
|
||||
let availableHeight = layout.size.height - (layout.inputHeight ?? 0.0) - 60.0
|
||||
let inputHeight = layout.inputHeight ?? 0.0
|
||||
let availableHeight = layout.size.height - inputHeight
|
||||
|
||||
let size = CGSize(width: 390.0, height: min(620.0, availableHeight))
|
||||
|
||||
@@ -1301,7 +1305,7 @@ public class AttachmentController: ViewController, MinimizableController {
|
||||
let masterWidth = min(max(320.0, floor(layout.size.width / 3.0)), floor(layout.size.width / 2.0))
|
||||
|
||||
let position: CGPoint
|
||||
let positionY = layout.size.height - size.height - insets.bottom - 54.0
|
||||
let positionY = layout.size.height - size.height - insets.bottom - (inputHeight > 0.0 ? 0.0 : 54.0)
|
||||
if let sourceRect = controller.getSourceRect?() {
|
||||
position = CGPoint(x: min(layout.size.width - size.width - 28.0, floor(sourceRect.midX - size.width / 2.0) - 2.0), y: min(positionY, sourceRect.minY - size.height))
|
||||
} else {
|
||||
@@ -1674,10 +1678,11 @@ public class AttachmentController: ViewController, MinimizableController {
|
||||
|
||||
public func makeContentSnapshotView() -> UIView? {
|
||||
let snapshotView = self.view.snapshotView(afterScreenUpdates: false)
|
||||
let navigationBarHeight = self.validLayout.flatMap { self.navigationLayout(layout: $0) }?.defaultContentHeight ?? 56.0
|
||||
if let contentSnapshotView = self.mainController.makeContentSnapshotView() {
|
||||
if !self.mainController.isFullscreen {
|
||||
if let layout = self.validLayout {
|
||||
contentSnapshotView.frame = contentSnapshotView.frame.offsetBy(dx: 0.0, dy: (layout.statusBarHeight ?? 0.0) + 10.0 + 56.0)
|
||||
contentSnapshotView.frame = contentSnapshotView.frame.offsetBy(dx: 0.0, dy: (layout.statusBarHeight ?? 0.0) + 10.0 + navigationBarHeight)
|
||||
}
|
||||
}
|
||||
snapshotView?.addSubview(contentSnapshotView)
|
||||
|
||||
@@ -27,10 +27,10 @@ import GlassBackgroundComponent
|
||||
|
||||
private let legacyButtonSize = CGSize(width: 88.0, height: 49.0)
|
||||
private let glassButtonSize = CGSize(width: 72.0, height: 62.0)
|
||||
private let smallGlassButtonSize = CGSize(width: 70.0, height: 62.0)
|
||||
private let smallGlassButtonSize = CGSize(width: 72.0, height: 62.0)
|
||||
private let smallButtonWidth: CGFloat = 69.0
|
||||
private let iconSize = CGSize(width: 30.0, height: 30.0)
|
||||
private let sideInset: CGFloat = 3.0
|
||||
private let glassPanelSideInset: CGFloat = 20.0
|
||||
|
||||
private final class IconComponent: Component {
|
||||
public let account: Account
|
||||
@@ -321,6 +321,8 @@ private final class AttachButtonComponent: CombinedComponent {
|
||||
transition: .immediate
|
||||
)
|
||||
|
||||
let size = CGSize(width: max(context.availableSize.width, title.size.width + 24.0), height: context.availableSize.height)
|
||||
|
||||
let button = button.update(
|
||||
component: Rectangle(
|
||||
color: .clear,
|
||||
@@ -332,7 +334,6 @@ private final class AttachButtonComponent: CombinedComponent {
|
||||
)
|
||||
|
||||
let titleFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((context.availableSize.width - title.size.width) / 2.0), y: iconFrame.midY + spacing), size: title.size)
|
||||
|
||||
context.add(title
|
||||
.position(CGPoint(x: titleFrame.midX, y: titleFrame.midY))
|
||||
)
|
||||
@@ -349,7 +350,7 @@ private final class AttachButtonComponent: CombinedComponent {
|
||||
}))
|
||||
)
|
||||
|
||||
return context.availableSize
|
||||
return size
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1471,37 +1472,42 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
let width: CGFloat
|
||||
let width = layout.size.width
|
||||
var panelSideInset: CGFloat
|
||||
switch self.panelStyle {
|
||||
case .glass:
|
||||
width = layout.size.width - 44.0
|
||||
panelSideInset = glassPanelSideInset + 3.0
|
||||
case .legacy:
|
||||
width = layout.size.width
|
||||
panelSideInset = 3.0
|
||||
}
|
||||
|
||||
let visibleRect = self.scrollNode.bounds.insetBy(dx: -180.0, dy: 0.0)
|
||||
|
||||
var distanceBetweenNodes = (width - sideInset * 2.0) / CGFloat(self.buttons.count)
|
||||
var distanceBetweenNodes = floorToScreenPixels((width - panelSideInset * 2.0 - self.buttonSize.width) / CGFloat(max(1, self.buttons.count - 1)))
|
||||
let internalWidth = distanceBetweenNodes * CGFloat(self.buttons.count - 1)
|
||||
var buttonWidth = self.buttonSize.width
|
||||
var leftNodeOriginX: CGFloat
|
||||
var maxButtonsToFit = 6
|
||||
switch self.panelStyle {
|
||||
case .glass:
|
||||
leftNodeOriginX = layout.safeInsets.left + sideInset + buttonWidth / 2.0
|
||||
leftNodeOriginX = layout.safeInsets.left + 3.0 + buttonWidth / 2.0
|
||||
if layout.size.width < 400.0 {
|
||||
maxButtonsToFit = 5
|
||||
}
|
||||
case .legacy:
|
||||
leftNodeOriginX = (width - internalWidth) / 2.0
|
||||
}
|
||||
|
||||
if self.buttons.count > 5 && layout.size.width < layout.size.height {
|
||||
if self.buttons.count > maxButtonsToFit && layout.size.width < layout.size.height {
|
||||
switch self.panelStyle {
|
||||
case .glass:
|
||||
buttonWidth = smallGlassButtonSize.width
|
||||
distanceBetweenNodes = 60.0
|
||||
distanceBetweenNodes = 62.0
|
||||
case .legacy:
|
||||
buttonWidth = smallButtonWidth
|
||||
distanceBetweenNodes = 60.0
|
||||
}
|
||||
leftNodeOriginX = layout.safeInsets.left + sideInset + buttonWidth / 2.0
|
||||
leftNodeOriginX = layout.safeInsets.left + 3.0 + buttonWidth / 2.0
|
||||
}
|
||||
|
||||
var validIds = Set<AnyHashable>()
|
||||
@@ -1559,7 +1565,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
|
||||
}
|
||||
}
|
||||
}
|
||||
let _ = buttonView.update(
|
||||
let actualButtonSize = buttonView.update(
|
||||
transition: buttonTransition,
|
||||
component: AnyComponent(AttachButtonComponent(
|
||||
context: self.context,
|
||||
@@ -1590,7 +1596,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
|
||||
)
|
||||
|
||||
if i == self.selectedIndex {
|
||||
selectionFrame = buttonFrame
|
||||
selectionFrame = CGRect(origin: CGPoint(x: buttonFrame.midX - actualButtonSize.width * 0.5, y: buttonFrame.minY), size: actualButtonSize)
|
||||
}
|
||||
buttonTransition.setFrame(view: buttonView, frame: buttonFrame)
|
||||
var accessibilityTitle = ""
|
||||
@@ -1635,7 +1641,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
|
||||
self.selectionNode.cornerRadius = selectionFrame.height * 0.5
|
||||
transition.setFrame(view: self.selectionNode.view, frame: selectionFrame)
|
||||
|
||||
mostRightX += layout.safeInsets.right + sideInset
|
||||
mostRightX += layout.safeInsets.right + 3.0
|
||||
|
||||
let contentSize = CGSize(width: mostRightX, height: self.buttonSize.height)
|
||||
if contentSize != self.scrollNode.view.contentSize {
|
||||
@@ -1877,7 +1883,9 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
|
||||
self.textInputPanelNode?.ensureUnfocused()
|
||||
}
|
||||
|
||||
let panelSideInset: CGFloat = isSelecting ? 8.0 : 22.0
|
||||
let textPanelSideInset: CGFloat = 8.0
|
||||
let defaultPanelSideInset: CGFloat = glassPanelSideInset
|
||||
let panelSideInset: CGFloat = isSelecting ? textPanelSideInset : defaultPanelSideInset
|
||||
var textPanelHeight: CGFloat = 0.0
|
||||
var textPanelWidth: CGFloat = 0.0
|
||||
if let textInputPanelNode = self.textInputPanelNode {
|
||||
@@ -2058,7 +2066,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate {
|
||||
containerTransition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: bounds.width, height: UIScreenPixel)))
|
||||
|
||||
if case .glass = self.panelStyle {
|
||||
transition.updateFrameAsPositionAndBounds(node: self.scrollNode, frame: CGRect(origin: CGPoint(x: self.isSelecting ? panelSideInset - 22.0 : panelSideInset, y: self.isSelecting ? -11.0 : 0.0), size: CGSize(width: layout.size.width - panelSideInset * 2.0, height: self.buttonSize.height)))
|
||||
transition.updateFrameAsPositionAndBounds(node: self.scrollNode, frame: CGRect(origin: CGPoint(x: self.isSelecting ? panelSideInset - defaultPanelSideInset : panelSideInset, y: self.isSelecting ? -11.0 : 0.0), size: CGSize(width: layout.size.width - panelSideInset * 2.0, height: self.buttonSize.height)))
|
||||
}
|
||||
|
||||
self.updateViews(transition: .immediate)
|
||||
|
||||
@@ -707,6 +707,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
SearchInputPanelComponent(
|
||||
theme: self.presentationData.theme,
|
||||
strings: self.presentationData.strings,
|
||||
metrics: layout.metrics,
|
||||
placeholder: nil,
|
||||
resetText: nil,
|
||||
updated: { [weak self] query in
|
||||
|
||||
@@ -320,6 +320,7 @@ final class AuthorizationSequenceCountrySelectionControllerNode: ASDisplayNode,
|
||||
SearchInputPanelComponent(
|
||||
theme: self.theme,
|
||||
strings: self.strings,
|
||||
metrics: layout.metrics,
|
||||
updated: { [weak self] query in
|
||||
guard let self else {
|
||||
return
|
||||
|
||||
@@ -250,7 +250,8 @@ public final class NavigationContainer: ASDisplayNode, ASGestureRecognizerDelega
|
||||
bottomController.viewWillAppear(true)
|
||||
let bottomNode = bottomController.displayNode
|
||||
|
||||
let navigationTransitionCoordinator = NavigationTransitionCoordinator(transition: .Pop, isInteractive: true, isFlat: self.isFlat, container: self, topNode: topNode, topNavigationBar: topController.transitionNavigationBar, bottomNode: bottomNode, bottomNavigationBar: bottomController.transitionNavigationBar, screenCornerRadius: layout.deviceMetrics.screenCornerRadius, didUpdateProgress: { [weak self, weak bottomController] progress, transition, topFrame, bottomFrame in
|
||||
let screenCornerRadius = self.minimizedContainer == nil ? layout.deviceMetrics.screenCornerRadius : 0.0
|
||||
let navigationTransitionCoordinator = NavigationTransitionCoordinator(transition: .Pop, isInteractive: true, isFlat: self.isFlat, container: self, topNode: topNode, topNavigationBar: topController.transitionNavigationBar, bottomNode: bottomNode, bottomNavigationBar: bottomController.transitionNavigationBar, screenCornerRadius: screenCornerRadius, didUpdateProgress: { [weak self, weak bottomController] progress, transition, topFrame, bottomFrame in
|
||||
if let strongSelf = self {
|
||||
if let top = strongSelf.state.top {
|
||||
strongSelf.syncKeyboard(leftEdge: top.value.displayNode.frame.minX, transition: transition)
|
||||
@@ -490,7 +491,8 @@ public final class NavigationContainer: ASDisplayNode, ASGestureRecognizerDelega
|
||||
}
|
||||
toValue.value.setIgnoreAppearanceMethodInvocations(false)
|
||||
|
||||
let topTransition = TopTransition(type: transitionType, previous: fromValue, coordinator: NavigationTransitionCoordinator(transition: mappedTransitionType, isInteractive: false, isFlat: self.isFlat, container: self, topNode: topController.displayNode, topNavigationBar: topController.transitionNavigationBar, bottomNode: bottomController.displayNode, bottomNavigationBar: bottomController.transitionNavigationBar, screenCornerRadius: layout.deviceMetrics.screenCornerRadius, didUpdateProgress: { [weak self] _, transition, topFrame, bottomFrame in
|
||||
let screenCornerRadius = self.minimizedContainer == nil ? layout.deviceMetrics.screenCornerRadius : 0.0
|
||||
let topTransition = TopTransition(type: transitionType, previous: fromValue, coordinator: NavigationTransitionCoordinator(transition: mappedTransitionType, isInteractive: false, isFlat: self.isFlat, container: self, topNode: topController.displayNode, topNavigationBar: topController.transitionNavigationBar, bottomNode: bottomController.displayNode, bottomNavigationBar: bottomController.transitionNavigationBar, screenCornerRadius: screenCornerRadius, didUpdateProgress: { [weak self] _, transition, topFrame, bottomFrame in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import AppBundle
|
||||
|
||||
public final class ItemListAddressItem: ListViewItem, ItemListItem {
|
||||
let theme: PresentationTheme
|
||||
let systemStyle: ItemListSystemStyle
|
||||
let label: String
|
||||
let text: String
|
||||
let imageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?
|
||||
@@ -25,8 +26,9 @@ public final class ItemListAddressItem: ListViewItem, ItemListItem {
|
||||
|
||||
public let tag: Any?
|
||||
|
||||
public init(theme: PresentationTheme, label: String, text: String, imageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?, selected: Bool? = nil, sectionId: ItemListSectionId, style: ItemListStyle, displayDecorations: Bool = true, action: (() -> Void)?, longTapAction: ((ASDisplayNode, String) -> Void)? = nil, linkItemAction: ((TextLinkItemActionType, TextLinkItem) -> Void)? = nil, tag: Any? = nil) {
|
||||
public init(theme: PresentationTheme, systemStyle: ItemListSystemStyle = .legacy, label: String, text: String, imageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?, selected: Bool? = nil, sectionId: ItemListSectionId, style: ItemListStyle, displayDecorations: Bool = true, action: (() -> Void)?, longTapAction: ((ASDisplayNode, String) -> Void)? = nil, linkItemAction: ((TextLinkItemActionType, TextLinkItem) -> Void)? = nil, tag: Any? = nil) {
|
||||
self.theme = theme
|
||||
self.systemStyle = systemStyle
|
||||
self.label = label
|
||||
self.text = text
|
||||
self.imageSignal = imageSignal
|
||||
@@ -167,6 +169,7 @@ public class ItemListAddressItemNode: ListViewItemNode {
|
||||
let leftInset: CGFloat = 16.0 + params.leftInset
|
||||
let rightInset: CGFloat = 8.0 + params.rightInset
|
||||
let separatorHeight = UIScreenPixel
|
||||
let separatorRightInset: CGFloat = item.systemStyle == .glass ? 16.0 : 0.0
|
||||
|
||||
let itemBackgroundColor: UIColor
|
||||
let itemSeparatorColor: UIColor
|
||||
@@ -202,11 +205,16 @@ public class ItemListAddressItemNode: ListViewItemNode {
|
||||
let (textLayout, textApply) = makeTextLayout(TextNodeLayoutArguments(attributedString: string, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: params.width - leftOffset - leftInset - rightInset - 98.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
let padding: CGFloat = !item.label.isEmpty ? 39.0 : 20.0
|
||||
|
||||
var verticalInset: CGFloat = 0.0
|
||||
if case .glass = item.systemStyle {
|
||||
verticalInset = 4.0
|
||||
}
|
||||
|
||||
let imageSide = min(90.0, max(66.0, textLayout.size.height + padding - 18.0))
|
||||
let imageSize = CGSize(width: imageSide, height: imageSide)
|
||||
let imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(radius: 4.0), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets()))
|
||||
let imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(radius: item.systemStyle == .glass ? 18.0 : 4.0), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets()))
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: max(textLayout.size.height + padding, imageSize.height + 14.0))
|
||||
let contentSize = CGSize(width: params.width, height: max(textLayout.size.height + padding, imageSize.height + 14.0) + verticalInset * 2.0)
|
||||
|
||||
let nodeLayout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
return (nodeLayout, { [weak self] animation in
|
||||
@@ -265,10 +273,10 @@ public class ItemListAddressItemNode: ListViewItemNode {
|
||||
})
|
||||
}
|
||||
|
||||
strongSelf.labelNode.frame = CGRect(origin: CGPoint(x: leftOffset + leftInset, y: 11.0), size: labelLayout.size)
|
||||
strongSelf.textNode.frame = CGRect(origin: CGPoint(x: leftOffset + leftInset, y: item.label.isEmpty ? 11.0 : 31.0), size: textLayout.size)
|
||||
strongSelf.labelNode.frame = CGRect(origin: CGPoint(x: leftOffset + leftInset, y: verticalInset + 11.0), size: labelLayout.size)
|
||||
strongSelf.textNode.frame = CGRect(origin: CGPoint(x: leftOffset + leftInset, y: verticalInset + (item.label.isEmpty ? 11.0 : 31.0)), size: textLayout.size)
|
||||
|
||||
let imageFrame = CGRect(origin: CGPoint(x: params.width - imageSize.width - rightInset, y: 7.0), size: imageSize)
|
||||
let imageFrame = CGRect(origin: CGPoint(x: params.width - imageSize.width - rightInset - 3.0, y: verticalInset + 7.0), size: imageSize)
|
||||
strongSelf.imageNode.frame = imageFrame
|
||||
|
||||
if let icon = strongSelf.iconNode.image {
|
||||
@@ -335,12 +343,12 @@ public class ItemListAddressItemNode: ListViewItemNode {
|
||||
strongSelf.bottomStripeNode.isHidden = hasCorners || !item.displayDecorations
|
||||
}
|
||||
|
||||
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.theme, top: hasTopCorners, bottom: hasBottomCorners) : nil
|
||||
strongSelf.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(item.theme, top: hasTopCorners, bottom: hasBottomCorners, glass: item.systemStyle == .glass) : nil
|
||||
|
||||
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
||||
strongSelf.maskNode.frame = strongSelf.backgroundNode.frame.insetBy(dx: params.leftInset, dy: 0.0)
|
||||
strongSelf.topStripeNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: separatorHeight))
|
||||
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: bottomStripeInset, y: contentSize.height + bottomStripeOffset), size: CGSize(width: params.width - bottomStripeInset, height: separatorHeight))
|
||||
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: bottomStripeInset, y: contentSize.height + bottomStripeOffset), size: CGSize(width: params.width - bottomStripeInset - params.rightInset - separatorRightInset, height: separatorHeight))
|
||||
}
|
||||
|
||||
strongSelf.highlightedBackgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -UIScreenPixel), size: CGSize(width: params.width, height: contentSize.height + UIScreenPixel + UIScreenPixel))
|
||||
|
||||
@@ -1441,6 +1441,7 @@ final class LocationPickerControllerNode: ViewControllerTracingNode, CLLocationM
|
||||
SearchInputPanelComponent(
|
||||
theme: self.presentationData.theme,
|
||||
strings: self.presentationData.strings,
|
||||
metrics: layout.metrics,
|
||||
placeholder: self.presentationData.strings.Map_Search,
|
||||
resetText: nil,
|
||||
updated: { [weak self] query in
|
||||
|
||||
@@ -237,6 +237,7 @@ private final class AttachmentFileSearchItemNode: ItemListControllerSearchNode {
|
||||
SearchInputPanelComponent(
|
||||
theme: self.theme,
|
||||
strings: self.strings,
|
||||
metrics: layout.metrics,
|
||||
placeholder: self.strings.Attachment_FilesSearchPlaceholder,
|
||||
resetText: nil,
|
||||
updated: { [weak self] query in
|
||||
|
||||
@@ -184,7 +184,7 @@ private final class PeerInfoScreenAddressItemNode: PeerInfoScreenItemNode {
|
||||
|
||||
self.bottomSeparatorNode.backgroundColor = presentationData.theme.list.itemBlocksSeparatorColor
|
||||
|
||||
let addressItem = ItemListAddressItem(theme: presentationData.theme, label: item.label, text: item.text, imageSignal: item.imageSignal, sectionId: 0, style: .blocks, displayDecorations: false, action: nil, longTapAction: nil, linkItemAction: item.linkItemAction)
|
||||
let addressItem = ItemListAddressItem(theme: presentationData.theme, systemStyle: .glass, label: item.label, text: item.text, imageSignal: item.imageSignal, sectionId: 0, style: .blocks, displayDecorations: false, action: nil, longTapAction: nil, linkItemAction: item.linkItemAction)
|
||||
|
||||
let params = ListViewItemLayoutParams(width: width, leftInset: safeInsets.left, rightInset: safeInsets.right, availableHeight: 1000.0)
|
||||
|
||||
@@ -216,14 +216,16 @@ private final class PeerInfoScreenAddressItemNode: PeerInfoScreenItemNode {
|
||||
|
||||
let height = itemNode.contentSize.height
|
||||
|
||||
transition.updateFrame(node: self.bottomSeparatorNode, frame: CGRect(origin: CGPoint(x: sideInset, y: height - UIScreenPixel), size: CGSize(width: width - sideInset, height: UIScreenPixel)))
|
||||
let separatorRightInset: CGFloat = 16.0
|
||||
|
||||
transition.updateFrame(node: self.bottomSeparatorNode, frame: CGRect(origin: CGPoint(x: sideInset, y: height - UIScreenPixel), size: CGSize(width: width - sideInset - separatorRightInset, height: UIScreenPixel)))
|
||||
transition.updateAlpha(node: self.bottomSeparatorNode, alpha: bottomItem == nil ? 0.0 : 1.0)
|
||||
|
||||
let hasCorners = hasCorners && (topItem == nil || bottomItem == nil)
|
||||
let hasTopCorners = hasCorners && topItem == nil
|
||||
let hasBottomCorners = hasCorners && bottomItem == nil
|
||||
|
||||
self.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(presentationData.theme, top: hasTopCorners, bottom: hasBottomCorners) : nil
|
||||
self.maskNode.image = hasCorners ? PresentationResourcesItemList.cornersImage(presentationData.theme, top: hasTopCorners, bottom: hasBottomCorners, glass: true) : nil
|
||||
transition.updateFrame(node: self.maskNode, frame: CGRect(origin: CGPoint(x: safeInsets.left, y: 0.0), size: CGSize(width: width - safeInsets.left - safeInsets.right, height: height)))
|
||||
self.bottomSeparatorNode.isHidden = hasBottomCorners
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ public final class SearchInputPanelComponent: Component {
|
||||
|
||||
public let theme: PresentationTheme
|
||||
public let strings: PresentationStrings
|
||||
public let metrics: LayoutMetrics
|
||||
public let placeholder: String?
|
||||
public let resetText: ResetText?
|
||||
public let updated: ((String) -> Void)
|
||||
@@ -36,6 +37,7 @@ public final class SearchInputPanelComponent: Component {
|
||||
public init(
|
||||
theme: PresentationTheme,
|
||||
strings: PresentationStrings,
|
||||
metrics: LayoutMetrics,
|
||||
placeholder: String? = nil,
|
||||
resetText: ResetText? = nil,
|
||||
updated: @escaping ((String) -> Void),
|
||||
@@ -43,6 +45,7 @@ public final class SearchInputPanelComponent: Component {
|
||||
) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.metrics = metrics
|
||||
self.placeholder = placeholder
|
||||
self.resetText = resetText
|
||||
self.updated = updated
|
||||
@@ -56,6 +59,9 @@ public final class SearchInputPanelComponent: Component {
|
||||
if lhs.strings !== rhs.strings {
|
||||
return false
|
||||
}
|
||||
if lhs.metrics != rhs.metrics {
|
||||
return false
|
||||
}
|
||||
if lhs.placeholder != rhs.placeholder {
|
||||
return false
|
||||
}
|
||||
@@ -180,7 +186,10 @@ public final class SearchInputPanelComponent: Component {
|
||||
|
||||
let backgroundColor = component.theme.list.plainBackgroundColor.withMultipliedAlpha(0.75)
|
||||
|
||||
let edgeInsets = UIEdgeInsets(top: 10.0, left: 11.0, bottom: 10.0, right: 11.0)
|
||||
var edgeInsets = UIEdgeInsets(top: 10.0, left: 11.0, bottom: 10.0, right: 11.0)
|
||||
if case .regular = component.metrics.widthClass {
|
||||
edgeInsets.bottom += 18.0
|
||||
}
|
||||
let fieldHeight: CGFloat = 48.0
|
||||
let buttonSpacing: CGFloat = 10.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user