-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix share extension navigation bar being transparent #19700
Fix share extension navigation bar being transparent #19700
Conversation
It always return `true` since the deployment version is 13.0, and will soon become 14.0.
You can test the changes in WordPress from this Pull Request by:
|
You can test the changes in Jetpack from this Pull Request by:
|
// We need to make sure we don't end up with stacked modal view controllers by using this: | ||
shareNavController.modalPresentationStyle = .overFullScreen | ||
} else { | ||
shareNavController.transitioningDelegate = extensionTransitioningManager |
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.
ExtensionTransitioningManager
is now unused. I didn't remove it in the context of this PR because removing it triggers a cascade of removals which felt more appropriate for a dedicated PR.
Using `.overFullScreen` or leaving `.automatic` resulted in Share being dismissable via swipe but that didn't restore Safari to the share menu, leaving it instead blocked as if the presented VC was still there. `.overCurrentContext` has no effect on the Save to Draft behavior, leaving it the same as when using `.overFullScreen`. On iPad, this setting result in both extensions not being full screen. Otherwise, Share would have been full screen while Save to Draft wouldn't.
shareNavController.transitioningDelegate = extensionTransitioningManager | ||
shareNavController.modalPresentationStyle = .custom | ||
} | ||
// We need to make sure we don't end up with stacked modal view controllers by using this: |
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.
🔍 notice the removal of the double space between "We" and "need" 🤓
👋 I'll be glad to look @mokagio, though I thought I slipped GitHub a $20 not to recommend me. Not quite related to this PR but something to flag, it looks like I see a prompt to open the WordPress app although it was triggered from the Jetpack sharing button. In this particular case my device had both apps installed and only WordPress was logged in. RPReplay_Final1669914567.MP4 |
@twstokes thank you Tanner! I guess 20 bucks is not enough for them? 🙃 Looks like "WordPress app" is hardcoded in the string, even though the copy is used in both Jetpack and WordPress. More ammo for my argument this ought to be a framework, not code added to multiple targets. |
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.
This LGTM @Gio2018! 🚀
I tested:
- iOS 15 and 16
- Light and dark modes
- iPhone and iPad (iOS 16 only)
- Different orientations
it would be great to extract all this logic in a standalone framework or package, and then make the individual extensions import it, and instantiate and configure the view controller to their liking
Sounds like a good idea!
FYI - I'll put in an issue for the above comment. Done: #19704 |
I came to this PR via #19513 (comment).
Originally, it was just a matter of removing the
#available(iOS 13, *)
check, but looking at the code and how it behaves at runtime, it became clear there's some more work to do in regards to the Share Extension. In particular whether I removed the entireelse
branch or I left it as it was, the presentation of the view controller for the share extension always resulted with a close to fully transparent navigation bar (see image below).The fix I implemented came after a bunch of trial and error and feels a bit like duck-tape. I left a comment with a suggestion for a better fix, but that would need to be a bigger structural-level kind of work.
What my fix consists of is merely changing the color of the navigation bar to match the standard one. 🙃
It's totally possible I'm misusing UIKit here—UI development is not my strong suit. If that's the case, I'm happy to hand this over to someone more capable than me in this area.
Before
After
On iPad
I don't know why they don't have the same size, but I think fixing that is out of scope for this PR.
Save to DraftTesting
To test these changes, I launched the app in the Simulator, went out of it (
Shift Cmd H
), opened Safari, and loaded both "Share" and "Save to Draft" extensions to verify the nav bar background color, modal presentation, and scrolling behavior behaved correctlyRegression Notes
RELEASE-NOTES.txt
if necessary. N.A.