Skip to content

Commit

Permalink
Fix for 2.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ulmentflam committed Oct 8, 2020
1 parent 780fc8e commit 1ee45b7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Pulley.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'Pulley'
s.version = ENV['LIB_VERSION'] || '2.8.4'
s.version = ENV['LIB_VERSION'] || '2.8.5'
s.summary = 'A library to imitate the iOS 10 Maps UI.'

# This description is used to generate tags and improve search results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-UIViewLayoutFeedbackLoopDebuggingThreshold 100"
argument = "-UIViewLayoutFeedbackLoopDebuggingThreshold 1"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
Expand Down
3 changes: 3 additions & 0 deletions Pulley/PrimaryContentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ extension PrimaryContentViewController: PulleyPrimaryContentControllerDelegate {

func drawerChangedDistanceFromBottom(drawer: PulleyViewController, distance: CGFloat, bottomSafeArea: CGFloat)
{
// As of iOS 14, setting the constant on the constraint causes viewDidLayoutSubviews() to be call
// on the PulleyViewController. This was causing issues with the drawer scroll view in 2.8.2+, see fix
// for issue #400 and update 2.8.5
guard drawer.currentDisplayMode == .drawer else {

temperatureLabelBottomConstraint.constant = temperatureLabelBottomDistance
Expand Down
31 changes: 29 additions & 2 deletions PulleyLib/PulleyViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,29 @@ public typealias PulleyAnimationCompletionBlock = ((_ finished: Bool) -> Void)
return .collapsed
}
}

public override func isEqual(_ object: Any?) -> Bool {
guard let position = object as? PulleyPosition else {
return false
}

return self.rawValue == position.rawValue
}

public override var description: String {
switch rawValue {
case 0:
return "collapsed"
case 1:
return "partiallyrevealed"
case 2:
return "open"
case 3:
return "closed"
default:
return "collapsed"
}
}
}

/// Represents the current display mode for Pulley
Expand Down Expand Up @@ -630,6 +645,8 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel

fileprivate var isAnimatingDrawerPosition: Bool = false

fileprivate var isChangingDrawerPosition: Bool = false

/// The height of the open position for the drawer
private var heightOfOpenDrawer: CGFloat {

Expand Down Expand Up @@ -955,7 +972,14 @@ open class PulleyViewController: UIViewController, PulleyDrawerViewControllerDel

maskDrawerVisualEffectView()
maskBackgroundDimmingView()
setDrawerPosition(position: drawerPosition, animated: false)

// Do not need to set the the drawer position in layoutSubview if the position of the drawer is changing
// and the view is being layed out. If the drawer position is changing and the view is layed out (i.e.
// a value or constraints are bing updated) the drawer is always set to the last position,
// and no longer scrolls properly.
if !isChangingDrawerPosition {
setDrawerPosition(position: drawerPosition, animated: false)
}
}

// MARK: Private State Updates
Expand Down Expand Up @@ -1527,6 +1551,7 @@ extension PulleyViewController: UIScrollViewDelegate {

public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {


if scrollView == drawerScrollView
{
// Find the closest anchor point and snap there.
Expand Down Expand Up @@ -1647,6 +1672,7 @@ extension PulleyViewController: UIScrollViewDelegate {

setDrawerPosition(position: positionToSnapTo, animated: true)
}
self.isChangingDrawerPosition = false
}
}

Expand All @@ -1667,6 +1693,7 @@ extension PulleyViewController: UIScrollViewDelegate {

if scrollView == drawerScrollView
{
self.isChangingDrawerPosition = true
let partialRevealHeight: CGFloat = (drawerContentViewController as? PulleyDrawerViewControllerDelegate)?.partialRevealDrawerHeight?(bottomSafeArea: pulleySafeAreaInsets.bottom) ?? kPulleyDefaultPartialRevealHeight

let lowestStop = getStopList().min() ?? 0
Expand Down

0 comments on commit 1ee45b7

Please sign in to comment.