-
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
Integrate TipKit #23470
Integrate TipKit #23470
Conversation
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
30cb2bc
to
2f220ec
Compare
a167ff9
to
09c408f
Compare
aaf8eff
to
7e99347
Compare
extension UIViewController { | ||
/// Registers a popover to be displayed for the given tip. | ||
@available(iOS 17, *) | ||
func registerTipPopover( |
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.
TipKit API for showing popovers was a bit too low-level, so I decided to add this convenience API on top of it.
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.
The term "register" gives of nothing will actually happen after this function is called. However, if I understand correctly, the function shows a tip if it certain criteria match. What do you think changing the name to something like presentTipPopoverIfNeeded
?
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'm open to suggestions, but presentTipPopoverIfNeeded
sounds like a one-shot method. This method subscribes to a tip.shouldDisplayUpdates
async sequence and shows/hides the popover as needed. So, yeah, nothing happens unless it fires an event.
The SwiftUI method with the same functionality is called popoverTip(_:arrowEdge:action:)
.
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 misunderstood how the tip.shouldDisplayUpdates
API works. The function name makes more sense to me now.
@@ -102,6 +102,18 @@ | |||
argument = "-debugJetpackConnectionFlow" | |||
isEnabled = "NO"> | |||
</CommandLineArgument> | |||
<CommandLineArgument | |||
argument = "-com.apple.TipKit.ShowAllTips 1" | |||
isEnabled = "NO"> |
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.
These options are all disabled by default.
Here's an example of a complete flow: Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-08-12.at.15.53.34.mp4 |
7e99347
to
d866a00
Compare
} else { | ||
if self?.presentedViewController is TipUIPopoverViewController { | ||
self?.dismiss(animated: true) | ||
} |
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 need to break out of the for loop when present
or dismiss
is called?
extension UIViewController { | ||
/// Registers a popover to be displayed for the given tip. | ||
@available(iOS 17, *) | ||
func registerTipPopover( |
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.
The term "register" gives of nothing will actually happen after this function is called. However, if I understand correctly, the function shows a tip if it certain criteria match. What do you think changing the name to something like presentTipPopoverIfNeeded
?
static func initialize() { | ||
guard Feature.enabled(.tipKit), #available(iOS 17, *) else { return } | ||
do { | ||
try Tips.configure([.displayFrequency(.daily)]) |
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.
If there are many Tips, does this daily frequency configuration mean other tips won't be displayed today if one of them has been displayed?
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 forgot to remove it after testing – done.
It might be something we go for in the future, but there is no need for it now.
return nil | ||
} | ||
let task = Task { @MainActor [weak self] in | ||
for await shouldDisplay in tip.shouldDisplayUpdates { |
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 think you'll need a if Task.isCancelled { break }
in this for-loop? task.cancel()
alone probably won't stop the loop.
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 code is from the Apple sample code. I'm not sure if it's clearly documented anywhere, but tip.shouldDisplayUpdates
async sequence (AsyncMapSequence
) receives cancellation from the task, aka cooperative cancellation.
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.
Ah okay. That's quite possible. Ignore my comments then, if the task can be properly cancelled. 🙂
TipKit
In #23469, we removed the
LoginEpilogue
screen, and the app now automatically selects one of your sites after login, defaulting to your primary site. To make sure the users learn how to switch to a different site, this PR integrate Apple's TipKit.The first time you log in with an existing account with two or more sites, the app will show the "Your Sites" tip. The tip is shown only once. If you log in on a different device with the same Apple ID, the previously shown tips are not shown again.
Resources
Quick Start
TipKit will also be used as a replacement for the existing Quick Start tours.
This PR removes the "What would you like to focus on first?" screen. It was added for the following reasons:
There was no follow-up, and this screen does nothing other than simply opening one of the selected primary areas in the app, but only after showing the "Enable Notifications?" screen.
This screen is also the entry point for the "existing site" Quick Start tour – the "Not sure, show me around" option. By removing it, you can no longer initiate this tour.
The next step would be to consider if there are any good candidates for being replaced with TipKit.
Debug Options
I added the following launch arguments to the schemes.
The same options are also added to the Debug Menu.
Testing
Regression Notes
Potential unintended areas of impact
What I did to test those areas of impact (or what existing automated tests I relied on)
What automated tests I added (or what prevented me from doing so)
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist: