Skip to content

Commit 5b7a934

Browse files
committed
Handle redirect for JetpackConnectionWebViewModel to detect completion
1 parent e3517d0 commit 5b7a934

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

WooCommerce/Classes/Authentication/Navigation Exceptions/JetpackConnectionWebViewModel.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,14 @@ final class JetpackConnectionWebViewModel: AuthenticatedWebViewModel {
2727
}
2828

2929
func handleRedirect(for url: URL?) {
30-
// No-op
30+
guard let path = url?.absoluteString else {
31+
return
32+
}
33+
// When the web view navigates to the site address or Jetpack plans page,
34+
// we can assume that the setup has completed.
35+
if path.hasPrefix(siteURL) || path.hasPrefix(Constants.plansPage) {
36+
handleSetupCompletion()
37+
}
3138
}
3239

3340
func decidePolicy(for navigationURL: URL) async -> WKNavigationActionPolicy {

0 commit comments

Comments
 (0)