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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change window access modifier to open #46

Merged
merged 7 commits into from
Jan 29, 2024

Conversation

julianrex
Copy link
Contributor

@julianrex julianrex commented Sep 1, 2023

Hello friends 馃槃

Small PR to change the window to open, along with a few other changes noted as comments.

Tested manually in an iPadOS application.

/cc @OdNairy

Comment on lines -203 to -209
func cancelScheduledFingerTipRemoval() {
fingerTipRemovalScheduled = true
NSObject.cancelPreviousPerformRequests(withTarget: self,
selector: #selector(removeInactiveFingerTips),
object: nil)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not used; I imagine that it was once used in conjunction with the perform(#selector(removeInactiveFingerTips), with: nil, afterDelay: 0.1). I do not see a need for it, but perhaps I'm not seeing the full picture.

@@ -233,16 +228,27 @@ public class FingerTipWindow: UIWindow {
return
}

UIView.animate(withDuration: fadeDuration) {
let animation = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The animated parameter wasn't being observed. As it is it seems that animated is always true, so we could simplify and rename to removeFingerTipAnimated(with:).

@julianrex
Copy link
Contributor Author

julianrex commented Sep 1, 2023

_overlayWindow?.isHidden = false

This causes the following warning in the console:

[Window] Manually adding the rootViewController's view to the view hierarchy is no longer supported. Please allow UIWindow to add the rootViewController's view to the view hierarchy itself.

Edit: Making the changes in f12793f removes this warning.

Comment on lines -14 to -24
class FingerTipOverlayWindow: UIWindow {
override var rootViewController: UIViewController? {
set {
super.rootViewController = newValue
}

get {
return FingerTipWindow.fingerTipWindow?.rootViewController ?? super.rootViewController
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was causing a warning in logs; the getter also looks suspicious - sharing a view controller between UIWindows sounds dangerous. I don't see any issue with removing this code.

Copy link
Collaborator

@OdNairy OdNairy left a comment

Choose a reason for hiding this comment

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

Thank you @julianrex for the improvements!

@OdNairy OdNairy merged commit 05ff26e into mapbox:main Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants