Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Display/ListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3666,6 +3666,9 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
self.highlightedItemIndex = nil
}

open func updateHiglightPercent(_ percent: CGFloat) {
}

public func updateNodeHighlightsAnimated(_ animated: Bool) {
let transition: ContainedViewLayoutTransition = animated ? .animated(duration: 0.35, curve: .spring) : .immediate
self.updateOverlayHighlight(transition: transition)
Expand Down
4 changes: 4 additions & 0 deletions Display/ListViewItemNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,10 @@ open class ListViewItemNode: ASDisplayNode {
open func setHighlighted(_ highlighted: Bool, at point: CGPoint, animated: Bool) {
}

open func setHighlightedPercent(_ percent: CGFloat) -> Bool {
return false
}

open func isReorderable(at point: CGPoint) -> Bool {
return false
}
Expand Down
6 changes: 4 additions & 2 deletions Display/NavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,8 @@ open class NavigationController: UINavigationController, ContainableController,

if let _ = previousControllers.index(where: { $0.controller === record.controller }) {
//previousControllers[index].transition = .appearance
let navigationTransitionCoordinator = NavigationTransitionCoordinator(transition: .Pop, container: self.controllerView.containerView, topView: previousController.view, topNavigationBar: (previousController as? ViewController)?.navigationBar, bottomView: record.controller.view, bottomNavigationBar: (record.controller as? ViewController)?.navigationBar)
let transitionType: NavigationTransition = .Pop
let navigationTransitionCoordinator = NavigationTransitionCoordinator(transition: transitionType, container: self.controllerView.containerView, topView: previousController.view, topNavigationBar: (previousController as? ViewController)?.navigationBar, bottomView: record.controller.view, bottomNavigationBar: (record.controller as? ViewController)?.navigationBar, alongsideTransition: (record.controller as? ViewController)?.navigationAlongsideTransition(type: transitionType))
self.navigationTransitionCoordinator = navigationTransitionCoordinator

self.controllerView.inTransition = true
Expand Down Expand Up @@ -684,7 +685,8 @@ open class NavigationController: UINavigationController, ContainableController,
bottomController.displayNode.recursivelyEnsureDisplaySynchronously(true)
}

let navigationTransitionCoordinator = NavigationTransitionCoordinator(transition: .Pop, container: self.controllerView.containerView, topView: topView, topNavigationBar: (topController as? ViewController)?.navigationBar, bottomView: bottomView, bottomNavigationBar: (bottomController as? ViewController)?.navigationBar)
let transitionType: NavigationTransition = .Pop
let navigationTransitionCoordinator = NavigationTransitionCoordinator(transition: transitionType, container: self.controllerView.containerView, topView: topView, topNavigationBar: (topController as? ViewController)?.navigationBar, bottomView: bottomView, bottomNavigationBar: (bottomController as? ViewController)?.navigationBar, alongsideTransition: (bottomController as? ViewController)?.navigationAlongsideTransition(type: transitionType))
self.navigationTransitionCoordinator = navigationTransitionCoordinator
}
case UIGestureRecognizerState.changed:
Expand Down
19 changes: 8 additions & 11 deletions Display/NavigationTransitionCoordinator.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit

enum NavigationTransition {
public enum NavigationTransition {
case Push
case Pop
}
Expand All @@ -14,15 +14,8 @@ private func generateShadow() -> UIImage? {
private let shadowImage = generateShadow()

class NavigationTransitionCoordinator {
private var _progress: CGFloat = 0.0
var progress: CGFloat {
get {
return self._progress
}
set(value) {
self._progress = value
self.updateProgress()
}
var progress: CGFloat = 0 {
didSet { updateProgress() }
}

private let container: UIView
Expand All @@ -39,9 +32,11 @@ class NavigationTransitionCoordinator {

private(set) var animatingCompletion = false
private var currentCompletion: (() -> Void)?
private let alongsideTransition: ((CGFloat) -> ())?

init(transition: NavigationTransition, container: UIView, topView: UIView, topNavigationBar: NavigationBar?, bottomView: UIView, bottomNavigationBar: NavigationBar?) {
init(transition: NavigationTransition, container: UIView, topView: UIView, topNavigationBar: NavigationBar?, bottomView: UIView, bottomNavigationBar: NavigationBar?, alongsideTransition: ((CGFloat) ->())? = nil) {
self.transition = transition
self.alongsideTransition = alongsideTransition
self.container = container
self.topView = topView
switch transition {
Expand Down Expand Up @@ -86,6 +81,8 @@ class NavigationTransitionCoordinator {
}

func updateProgress() {
alongsideTransition?(progress)

let position: CGFloat
switch self.transition {
case .Push:
Expand Down
4 changes: 4 additions & 0 deletions Display/TabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ open class TabBarController: ViewController {
return self.tabBarControllerNode.tabBarNode.sourceNodesForController(at: index)
}

override open func navigationAlongsideTransition(type: NavigationTransition) -> ((CGFloat) -> ())? {
return currentController?.navigationAlongsideTransition(type: type)
}

override open func loadDisplayNode() {
self.displayNode = TabBarControllerNode(theme: self.theme, navigationBar: self.navigationBar, itemSelected: { [weak self] index, longTap, itemNodes in
if let strongSelf = self {
Expand Down
4 changes: 4 additions & 0 deletions Display/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ open class ViewControllerPresentationArguments {
}
}

open func navigationAlongsideTransition(type: NavigationTransition) -> ((CGFloat) -> ())? {
return nil
}

private let _ready = Promise<Bool>(true)
open var ready: Promise<Bool> {
return self._ready
Expand Down