File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
WooCommerce/Classes/Authentication Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,6 @@ private extension AuthenticatedWebViewController {
8787 }
8888
8989 func startLoading( ) {
90- guard let url = viewModel. initialURL else {
91- return
92- }
9390 webView. publisher ( for: \. estimatedProgress)
9491 . sink { [ weak self] progress in
9592 if progress == 1 {
@@ -102,10 +99,26 @@ private extension AuthenticatedWebViewController {
10299
103100 webView. publisher ( for: \. url)
104101 . sink { [ weak self] url in
105- self ? . viewModel. handleRedirect ( for: url)
102+ if url? . absoluteString. contains ( WKWebView . wporgNoncePath) == true {
103+ self ? . loadContent ( )
104+ } else {
105+ self ? . viewModel. handleRedirect ( for: url)
106+ }
106107 }
107108 . store ( in: & subscriptions)
108109
110+ if let wporgCredentials = viewModel. wporgCredentials,
111+ let request = try ? webView. authenticateForWPOrg ( with: wporgCredentials) {
112+ webView. load ( request)
113+ } else {
114+ loadContent ( )
115+ }
116+ }
117+
118+ private func loadContent( ) {
119+ guard let url = viewModel. initialURL else {
120+ return
121+ }
109122 if let credentials = ServiceLocator . stores. sessionManager. defaultCredentials {
110123 webView. authenticateForWPComAndRedirect ( to: url, credentials: credentials)
111124 } else {
You can’t perform that action at this time.
0 commit comments