Merge branch 'master' into voiceover

This commit is contained in:
Peter Iakovlev 2019-01-18 01:43:02 +04:00
commit 173dfa711a
8 changed files with 41 additions and 56 deletions

View File

@ -104,7 +104,7 @@ final class AuthorizationSequencePasswordEntryControllerNode: ASDisplayNode, UIT
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
self.layoutArguments = (layout, navigationBarHeight)
var insets = layout.insets(options: [.input])
var insets = layout.insets(options: [])
insets.top = navigationBarHeight
if let inputHeight = layout.inputHeight {

View File

@ -197,7 +197,7 @@ final class AuthorizationSequenceSignUpControllerNode: ASDisplayNode, UITextFiel
func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
self.layoutArguments = (layout, navigationBarHeight)
var insets = layout.insets(options: [.statusBar, .input])
var insets = layout.insets(options: [.statusBar])
if let inputHeight = layout.inputHeight {
if abs(inputHeight - (layout.standardInputHeight - 44.0)) < 2.0 {
insets.bottom += layout.standardInputHeight

View File

@ -260,6 +260,7 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
self.searchContentNode = NavigationBarSearchContentNode(theme: self.presentationData.theme, placeholder: self.presentationData.strings.DialogList_SearchLabel, activate: { [weak self] in
self?.activateSearch()
})
self.searchContentNode?.updateExpansionProgress(0.0)
self.navigationBar?.setContentNode(self.searchContentNode, animated: false)
}

View File

@ -20,6 +20,31 @@ private func fixListNodeScrolling(_ listNode: ListView, searchNode: NavigationBa
listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: ListViewDeleteAndInsertOptions(), scrollToItem: scrollToItem, updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
return true
} else if searchNode.expansionProgress == 1.0 {
var sortItemNode: ListViewItemNode?
var nextItemNode: ListViewItemNode?
listNode.forEachItemNode({ itemNode in
if sortItemNode == nil, let itemNode = itemNode as? ContactListActionItemNode {
sortItemNode = itemNode
} else if sortItemNode != nil && nextItemNode == nil {
nextItemNode = itemNode as? ListViewItemNode
}
})
if let sortItemNode = sortItemNode {
let itemFrame = sortItemNode.apparentFrame
if itemFrame.contains(CGPoint(x: 0.0, y: listNode.insets.top)) {
var scrollToItem: ListViewScrollToItem?
if itemFrame.minY + itemFrame.height * 0.6 < listNode.insets.top {
scrollToItem = ListViewScrollToItem(index: 0, position: .top(-50), animated: true, curve: .Default(duration: 0.3), directionHint: .Up)
} else {
scrollToItem = ListViewScrollToItem(index: 0, position: .top(0), animated: true, curve: .Default(duration: 0.3), directionHint: .Up)
}
listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: ListViewDeleteAndInsertOptions(), scrollToItem: scrollToItem, updateSizeAndInsets: nil, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
return true
}
}
}
return false
}

View File

@ -27,6 +27,8 @@ func qrCode(string: String, color: UIColor, backgroundColor: UIColor? = nil, sca
let scale = arguments.drawingRect.size.width / inputImage.extent.width * context.scale
let transformed = inputImage.transformed(by: CGAffineTransform.init(scaleX: scale, y: scale))
let codeScale = 43.0 / inputImage.extent.width
let invertFilter = CIFilter(name: "CIColorInvert")
invertFilter?.setValue(transformed, forKey: kCIInputImageKey)
let alphaFilter = CIFilter(name: "CIMaskToAlpha")
@ -63,12 +65,11 @@ func qrCode(string: String, color: UIColor, backgroundColor: UIColor? = nil, sca
c.setFillColor(UIColor.clear.cgColor)
}
let clipOrigin = 93.0 * fittedRect.width / 267.0
let clipSide = 81.0 * fittedRect.width / 267.0
c.fill(CGRect(x: clipOrigin, y: clipOrigin, width: clipSide, height: clipSide))
let clipSide = 81.0 * fittedRect.width / 267.0 * codeScale
c.fill(CGRect(x: fittedRect.midX - clipSide / 2.0, y: fittedRect.midY - clipSide / 2.0, width: clipSide, height: clipSide))
c.setBlendMode(.normal)
let iconScale = fittedRect.width / 308.0
let iconScale = fittedRect.width / 308.0 * codeScale
let iconSize = CGSize(width: 65.0 * iconScale, height: 79.0 * iconScale)
let point = CGPoint(x: fittedRect.midX - iconSize.width / 2.0, y: fittedRect.midY - iconSize.height / 2.0)
c.translateBy(x: point.x, y: point.y)

View File

@ -154,7 +154,10 @@ final class RadialDownloadContentNode: RadialStatusContentNode {
self.leftLine.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, delay: 0.07, removeOnCompletion: false) { finished in
completion(0.0)
}
self.rightLine.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, delay: 0.07, removeOnCompletion: false)
self.rightLine.animateAlpha(from: 1.0, to: 0.0, duration: 0.02, delay: 0.15, removeOnCompletion: false) { finished in
self.leftLine.strokeColor = UIColor.clear.cgColor
self.rightLine.strokeColor = UIColor.clear.cgColor
}
}
override func animateOut(to: RadialStatusNodeState, completion: @escaping () -> Void) {

View File

@ -75,55 +75,6 @@ public final class TelegramRootController: NavigationController {
self.accountSettingsController = accountSettingsController
self.rootTabController = tabBarController
self.pushViewController(tabBarController, animated: false)
// guard let controller = self.viewControllers.last as? ViewController else {
// return
// }
//
// DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.15) {
// //(controller.navigationController as? NavigationController)?.pushViewController(ThemeGridController(account: self.account))
//
// let wrapperNode = ASDisplayNode()
// let bounds = controller.displayNode.bounds
// wrapperNode.frame = bounds
// wrapperNode.backgroundColor = .gray
// controller.displayNode.addSubnode(wrapperNode)
//
// let radialStatusSize: CGFloat = 50.0
// let statusNode = RadialStatusNode(backgroundNodeColor: UIColor(rgb: 0x000000, alpha: 0.6))
// statusNode.frame = CGRect(origin: CGPoint(x: floor(bounds.midX - radialStatusSize / 2.0), y: floor(bounds.midY - radialStatusSize / 2.0)), size: CGSize(width: radialStatusSize, height: radialStatusSize))
// wrapperNode.addSubnode(statusNode)
//
// let color = UIColor.white
// var smth = false
// let button = HighlightTrackingButtonNode()
// button.frame = CGRect(origin: CGPoint(x: floor(bounds.midX - radialStatusSize / 2.0), y: floor(bounds.midY - radialStatusSize / 2.0)), size: CGSize(width: radialStatusSize, height: radialStatusSize))
// wrapperNode.addSubnode(button)
// button.highligthedChanged = { value in
// if value {
// if smth {
// smth = false
// //statusNode.transitionToState(.play(color), animated: true, completion: {})
// statusNode.transitionToState(.download(.white), animated: true, completion: {})
//// statusNode.transitionToState(.progress(color: color, lineWidth: nil, value: 1.0, cancelEnabled: true), animated: true, completion: {})
//// statusNode.transitionToState(.none, animated: true, completion: {
//// DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.85) {
//// statusNode.transitionToState(.download(.white), animated: true, completion: {})
//// }
//// })
// } else {
// smth = true
// statusNode.transitionToState(.progress(color: color, lineWidth: nil, value: 0.1, cancelEnabled: true), animated: true, completion: {})
// }
// }
// }
// button.addTarget(self, action: #selector(self.mock), forControlEvents: .touchUpInside)
// statusNode.transitionToState(.download(.white), animated: false, completion: {})
// }
}
@objc func mock() {
}
public func updateRootControllers(showCallsTab: Bool) {

View File

@ -257,6 +257,10 @@ class WallpaperGalleryController: ViewController {
super.viewDidAppear(animated)
self.galleryNode.modalAnimateIn()
if let centralItemNode = self.galleryNode.pager.centralItemNode() as? WallpaperGalleryItemNode {
self.centralItemStatus.set(centralItemNode.status.get())
}
}
override func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {