Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent complete animators from causing drawing #505

Merged
merged 5 commits into from
Jun 30, 2021

Conversation

macdrevx
Copy link
Contributor

@macdrevx macdrevx commented Jun 29, 2021

Fixes: #469

Pull request checklist:

  • Briefly describe the changes in this PR.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Apply changelog label ('breaking change', 'bug 🪲', 'build', 'docs', 'feature 🍏', 'performance ⚡', 'testing 💯') or use the label 'skip changelog'
  • Update changelog

Summary of changes

  • No public API changes
  • Fixed an issue where animators created by fly to and ease to were not released until the next fly to or ease to began
  • Fixed an issue where a complete animator would trigger redrawing unnecessarily
  • Refactored related code for improved testability
  • Reorganized files in the MapView and MapViewTests directories into Foundation and FoundationTests, respectively

@macdrevx macdrevx added bug 🪲 Something is broken! performance ⚡ Updates to the performance, metrics, or optimization of the SDK labels Jun 29, 2021
@nishant-karajgikar
Copy link
Contributor

Could we run device tests before merging this PR? You can use [run device tests].

Comment on lines +3 to +16
internal protocol MapViewDependencyProviderProtocol {
func makeMetalView(frame: CGRect, device: MTLDevice?) -> MTKView
func makeDisplayLink(window: UIWindow, target: Any, selector: Selector) -> DisplayLinkProtocol?
}

internal final class MapViewDependencyProvider: MapViewDependencyProviderProtocol {
func makeMetalView(frame: CGRect, device: MTLDevice?) -> MTKView {
MTKView(frame: frame, device: device)
}

func makeDisplayLink(window: UIWindow, target: Any, selector: Selector) -> DisplayLinkProtocol? {
window.screen.displayLink(withTarget: target, selector: selector)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇🏾 this is awesome.. We've needed to do this for a long time!

Comment on lines +9 to +13
let makeMetalViewStub = Stub<MakeMetalViewParams, MockMetalView?>(defaultReturnValue: nil)
func makeMetalView(frame: CGRect, device: MTLDevice?) -> MTKView {
makeMetalViewStub.returnValueQueue.append(MockMetalView(frame: frame, device: device))
return makeMetalViewStub.call(with: MakeMetalViewParams(frame: frame, device: device))!
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add return value generator block

@macdrevx macdrevx merged commit 2ea2752 into main Jun 30, 2021
@macdrevx macdrevx deleted the ah/fix-complete-animators-trigger-drawing branch June 30, 2021 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something is broken! performance ⚡ Updates to the performance, metrics, or optimization of the SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Abnormal CPU usage
2 participants