-
Notifications
You must be signed in to change notification settings - Fork 121
Address windows deprecation warning
#8327
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also the option to split this into one computed var for
currentWindowSceneand one that callskeyWindowon it.I suggest this because I noticed one instance in which we call this
currentKeyWindowonly to then access thewindowSceneof the result:woocommerce-ios/WooCommerce/Classes/ViewRelated/Products/SKU Scanner/BarcodeScannerViewController.swift
Line 209 in f629e6c
For additional reference, we also have the code below that uses
windowScene, although that one does it starting bottom-up from aUIViewController, rather than top-down fromUIApplication.woocommerce-ios/WooCommerce/Classes/Extensions/UIViewController+AppReview.swift
Lines 25 to 40 in f629e6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should delete this re-implementation? The original
keyWindowAPI has been deprecated for three years. Maybe it's time to stop relying on the no longer true concept that there is one "key window" across the whole application?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point 🤔 I think the solution might vary on a case by case basis across the various usages of this
currentKeyWindowcomputed property.I left a comment in a pre-existing issue on the topic that I didn't know about till your comment prompted me to do more research.
@koke, as the author of that issue, have you got any additional context or ideas how to go about this?
I value the removal of the warning and I'm tempted to argue for merging this to reduce the warnings noise. At the same time, I'm well to aware that if we silence it, we might not address the lack of multi window support for a while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a lot of experience dealing with windows and scenes, but I agree with @crazytonyli that the best approach is probably to get rid of this method. Looking at usage, I see two distinct use cases:
ProcessConfiguration.shouldDisableAnimationsis true. For this case, we could as well iterate through allUIApplication.shared.connectedScenesand set the layer speed for all their key windows.UIViewController, which could useview.windowinstead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a draft to remove
currentKeyWindow: #8440 as discussed above. It's mostly done, but I'll do additional testing next week on specific views functionality.