diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 4a6703e8100..b5a1dd61fdb 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -7,6 +7,7 @@ - [*] Receipts: Email receipts can now be sent to customers after failed payments using WooCommerce Stripe 9.1.0+. [https://github.com/woocommerce/woocommerce-ios/pull/14864]. - [*] Order Creation: orders are always created using the store's currency, not the user's [https://github.com/woocommerce/woocommerce-ios/pull/14907] - [*] Dashboard: Updated the drag gesture on the Performance chart to show stats instantly. [https://github.com/woocommerce/woocommerce-ios/pull/14906] +- [*] Product Form: Support previewing products on coming-soon stores. [https://github.com/woocommerce/woocommerce-ios/pull/14931] - [*] Jetpack Setup: Fix issue setting up Jetpack for JCP sites when authenticated without WPCom and removing application password after completion [https://github.com/woocommerce/woocommerce-ios/pull/14929] - [Internal] Removed feedback survey for Store Setup feature [https://github.com/woocommerce/woocommerce-ios/pull/14888] - [Internal] Removed feedback survey for shipping label creation [https://github.com/woocommerce/woocommerce-ios/pull/14889] diff --git a/WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift b/WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift index 9e8d6d7dc67..85515e85c12 100644 --- a/WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift +++ b/WooCommerce/Classes/ViewRelated/Products/Edit Product/ProductFormViewController.swift @@ -254,6 +254,10 @@ final class ProductFormViewController: saveProduct(status: .published) } + @objc func dismissPresentedViewController() { + presentedViewController?.dismiss(animated: true, completion: nil) + } + func saveProductAsDraft() { if viewModel.formType == .add { ServiceLocator.analytics.track(.addProductSaveAsDraftTapped, withProperties: ["product_type": product.productType.rawValue]) @@ -1042,7 +1046,21 @@ private extension ProductFormViewController { guard let url = URL(string: product.permalink) else { return } - WebviewHelper.launch(url, with: self) + + let stores = ServiceLocator.stores + guard let site = stores.sessionManager.defaultSite, + stores.shouldAuthenticateAdminPage(for: site) else { + WebviewHelper.launch(url.absoluteString, with: self) + return + } + + let viewModel = DefaultAuthenticatedWebViewModel(title: product.name, initialURL: url) + let controller = AuthenticatedWebViewController(viewModel: viewModel) + let navigationController = UINavigationController(rootViewController: controller) + controller.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, + target: self, + action: #selector(dismissPresentedViewController)) + present(navigationController, animated: true) } func displayShareProduct(from sourceView: UIBarButtonItem, analyticSource: WooAnalyticsEvent.ProductForm.ShareProductSource) { diff --git a/WooCommerce/Classes/ViewRelated/ReusableViews/LabeledTextViewTableViewCell.swift b/WooCommerce/Classes/ViewRelated/ReusableViews/LabeledTextViewTableViewCell.swift index 883634d2c03..f2caa28d32d 100644 --- a/WooCommerce/Classes/ViewRelated/ReusableViews/LabeledTextViewTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/ReusableViews/LabeledTextViewTableViewCell.swift @@ -44,6 +44,7 @@ private extension LabeledTextViewTableViewCell { func configureBackground() { backgroundColor = .systemColor(.secondarySystemGroupedBackground) productTextField.backgroundColor = .systemColor(.secondarySystemGroupedBackground) + productStatusBadgeHolder.backgroundColor = .listForeground(modal: false) } func configureLabelStyle() {