Skip to content

Commit d2091c2

Browse files
committed
Use authenticated WebKitViewController to handle product previews
1 parent ce39acf commit d2091c2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,17 @@ private extension ProductFormViewController {
803803
return
804804
}
805805

806-
WebviewHelper.launch(url, with: self)
806+
let credentials = ServiceLocator.stores.sessionManager.defaultCredentials
807+
guard let username = credentials?.username,
808+
let token = credentials?.authToken,
809+
let site = ServiceLocator.stores.sessionManager.defaultSite else {
810+
return
811+
}
812+
813+
let configuration = WebViewControllerConfiguration(url: url)
814+
configuration.authenticate(site: site, username: username, token: token)
815+
let vc = WebKitViewController(configuration: configuration)
816+
present(vc, animated: true)
807817
}
808818

809819
func duplicateProduct() {

0 commit comments

Comments
 (0)