File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
WooCommerce/Classes/Authentication Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11import Combine
22import UIKit
33import WebKit
4+ import struct WordPressAuthenticator. WordPressOrgCredentials
45
56/// A web view which is authenticated for WordPress.com, when possible.
67///
@@ -26,8 +27,13 @@ final class AuthenticatedWebViewController: UIViewController {
2627 /// Strong reference for the subscription to update progress bar
2728 private var subscriptions : Set < AnyCancellable > = [ ]
2829
29- init ( viewModel: AuthenticatedWebViewModel ) {
30+ /// Optional credentials for authenticating with WP.org
31+ ///
32+ private let wporgCredentials : WordPressOrgCredentials ?
33+
34+ init ( viewModel: AuthenticatedWebViewModel , wporgCredentials: WordPressOrgCredentials ? = nil ) {
3035 self . viewModel = viewModel
36+ self . wporgCredentials = wporgCredentials
3137 super. init ( nibName: nil , bundle: nil )
3238 }
3339
@@ -107,8 +113,7 @@ private extension AuthenticatedWebViewController {
107113 }
108114 . store ( in: & subscriptions)
109115
110- if let wporgCredentials = viewModel. wporgCredentials,
111- let request = try ? webView. authenticateForWPOrg ( with: wporgCredentials) {
116+ if let wporgCredentials, let request = try ? webView. authenticateForWPOrg ( with: wporgCredentials) {
112117 webView. load ( request)
113118 } else {
114119 loadContent ( )
You can’t perform that action at this time.
0 commit comments