Skip to content

Commit 8c6c202

Browse files
committed
Allow jetpack.com/app to be handled without requiring authentication
1 parent 605c029 commit 8c6c202

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

WordPress/Classes/System/WordPressAppDelegate.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,14 @@ extension WordPressAppDelegate {
505505
}
506506

507507
func handleWebActivity(_ activity: NSUserActivity) {
508+
// try to handle unauthenticated routes first.
509+
if activity.activityType == NSUserActivityTypeBrowsingWeb,
510+
let url = activity.webpageURL,
511+
UniversalLinkRouter.unauthenticated.canHandle(url: url) {
512+
UniversalLinkRouter.unauthenticated.handle(url: url)
513+
return
514+
}
515+
508516
guard AccountHelper.isLoggedIn,
509517
activity.activityType == NSUserActivityTypeBrowsingWeb,
510518
let url = activity.webpageURL else {

WordPress/Classes/Utility/Universal Links/UniversalLinkRouter.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ struct UniversalLinkRouter: LinkRouter {
2525
static let shared = UniversalLinkRouter(
2626
routes: defaultRoutes)
2727

28+
// A singleton that handles universal link routes without requiring authentication.
29+
//
30+
static let unauthenticated = UniversalLinkRouter(routes: jetpackRoutes)
31+
2832
static let defaultRoutes: [Route] =
2933
redirects +
3034
meRoutes +

0 commit comments

Comments
 (0)