From af33921bf6779af25ae9492a695308563ea65876 Mon Sep 17 00:00:00 2001 From: Stephenie Harris Date: Tue, 26 Apr 2022 14:45:03 -0600 Subject: [PATCH 1/5] Set a dynamic width and height on the prompt card view. --- .../BloggingPromptsFeatureDescriptionView.xib | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.xib b/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.xib index 63dfc17cd737..c51b8e1ce7d2 100644 --- a/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.xib +++ b/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.xib @@ -16,20 +16,20 @@ - + - + - + @@ -40,11 +40,11 @@ + - - + From 1b0c5c50bd7bea69ba6dd37e302de8e1d5820a8f Mon Sep 17 00:00:00 2001 From: Stephenie Harris Date: Tue, 26 Apr 2022 14:45:36 -0600 Subject: [PATCH 2/5] Use the prompt card's cardFrameView so it will resize dynamically. --- .../Prompts/DashboardPromptsCardCell.swift | 51 ++++++++++--------- ...loggingPromptsFeatureDescriptionView.swift | 16 +++--- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift index 8d1da82324e5..db31a79e57be 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift @@ -13,6 +13,32 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable { } } + // This is public so it can be accessed from the BloggingPromptsFeatureDescriptionView. + lazy var cardFrameView: BlogDashboardCardFrameView = { + let frameView = BlogDashboardCardFrameView() + frameView.translatesAutoresizingMaskIntoConstraints = false + frameView.title = Strings.cardFrameTitle + frameView.icon = Style.frameIconImage + + // NOTE: Remove the logic for iOS 13 once we drop that version. + if #available (iOS 14.0, *) { + // assign an empty closure so the button appears. + frameView.onEllipsisButtonTap = {} + frameView.ellipsisButton.showsMenuAsPrimaryAction = true + frameView.ellipsisButton.menu = contextMenu + } else { + // Show a fallback implementation using `MenuSheetViewController`. + // iOS 13 doesn't support showing UIMenu programmatically. + frameView.onEllipsisButtonTap = { [weak self] in + self?.showMenuSheet() + } + } + + return frameView + }() + + // MARK: - Private Properties + /// When set to true, a "default" version of the card is displayed. That is: /// - `maxAvatarCount` number of avatars. /// - `maxAvatarCount` answer count. @@ -25,8 +51,6 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable { } } - // MARK: - Private Properties - // Used to present the menu sheet for contextual menu. // NOTE: Remove this once we drop support for iOS 13. private weak var presenterViewController: BlogDashboardViewController? = nil @@ -39,29 +63,6 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable { return stackView }() - private lazy var cardFrameView: BlogDashboardCardFrameView = { - let frameView = BlogDashboardCardFrameView() - frameView.translatesAutoresizingMaskIntoConstraints = false - frameView.title = Strings.cardFrameTitle - frameView.icon = Style.frameIconImage - - // NOTE: Remove the logic for iOS 13 once we drop that version. - if #available (iOS 14.0, *) { - // assign an empty closure so the button appears. - frameView.onEllipsisButtonTap = {} - frameView.ellipsisButton.showsMenuAsPrimaryAction = true - frameView.ellipsisButton.menu = contextMenu - } else { - // Show a fallback implementation using `MenuSheetViewController`. - // iOS 13 doesn't support showing UIMenu programmatically. - frameView.onEllipsisButtonTap = { [weak self] in - self?.showMenuSheet() - } - } - - return frameView - }() - // MARK: Top row views private lazy var promptLabel: UILabel = { diff --git a/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.swift b/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.swift index 02aa5347db42..efe2499d71d0 100644 --- a/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.swift +++ b/WordPress/Classes/ViewRelated/Feature Introduction/Blogging Prompts/BloggingPromptsFeatureDescriptionView.swift @@ -28,15 +28,17 @@ private extension BloggingPromptsFeatureDescriptionView { func configurePromptCard() { let promptCard = DashboardPromptsCardCell() promptCard.configureForExampleDisplay() - promptCard.translatesAutoresizingMaskIntoConstraints = false - promptCard.layer.cornerRadius = Style.cardCornerRadius - promptCard.layer.shadowOffset = Style.cardShadowOffset - promptCard.layer.shadowOpacity = Style.cardShadowOpacity - promptCard.layer.shadowRadius = Style.cardShadowRadius + // The DashboardPromptsCardCell doesn't resize dynamically when used in this context. + // So use its cardFrameView instead. + promptCard.cardFrameView.translatesAutoresizingMaskIntoConstraints = false + promptCard.cardFrameView.layer.cornerRadius = Style.cardCornerRadius + promptCard.cardFrameView.layer.shadowOffset = Style.cardShadowOffset + promptCard.cardFrameView.layer.shadowOpacity = Style.cardShadowOpacity + promptCard.cardFrameView.layer.shadowRadius = Style.cardShadowRadius - promptCardView.addSubview(promptCard) - promptCardView.pinSubviewToSafeArea(promptCard) + promptCardView.addSubview(promptCard.cardFrameView) + promptCardView.pinSubviewToAllEdges(promptCard.cardFrameView) } func configureDescription() { From 5b92771563f9fd260b47b147743c71b1b413db22 Mon Sep 17 00:00:00 2001 From: Stephenie Harris Date: Tue, 26 Apr 2022 16:10:51 -0600 Subject: [PATCH 3/5] Set footer background color. --- .../Collapsable Header/CollapsableHeaderViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift index 787ca2ba9359..c05e7e0bbbbc 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift @@ -508,6 +508,7 @@ class CollapsableHeaderViewController: UIViewController, NoResultsViewHost { func configureVerticalButtonView() { usesVerticalActionButtons = true + footerView.backgroundColor = .systemBackground footerHeightContraint.constant = footerHeight selectedStateButtonsContainer.axis = .vertical From ff9e6fce4549dc247982ddba915dfabec5e37d1d Mon Sep 17 00:00:00 2001 From: ScoutHarris Date: Wed, 27 Apr 2022 12:21:52 -0600 Subject: [PATCH 4/5] Update WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift Set var to read-only. Co-authored-by: David Christiandy <1299411+dvdchr@users.noreply.github.com> --- .../Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift index db31a79e57be..39b4e82a4503 100644 --- a/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift +++ b/WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift @@ -14,7 +14,7 @@ class DashboardPromptsCardCell: UICollectionViewCell, Reusable { } // This is public so it can be accessed from the BloggingPromptsFeatureDescriptionView. - lazy var cardFrameView: BlogDashboardCardFrameView = { + private(set) lazy var cardFrameView: BlogDashboardCardFrameView = { let frameView = BlogDashboardCardFrameView() frameView.translatesAutoresizingMaskIntoConstraints = false frameView.title = Strings.cardFrameTitle From 0a30b78fb2e749e4369a022a10924c25fc4b67f1 Mon Sep 17 00:00:00 2001 From: Stephenie Harris Date: Wed, 27 Apr 2022 13:11:59 -0600 Subject: [PATCH 5/5] Set navigation bar background color. --- .../Collapsable Header/CollapsableHeaderViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift index c05e7e0bbbbc..b327349a642f 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift @@ -521,6 +521,7 @@ class CollapsableHeaderViewController: UIViewController, NoResultsViewHost { visualEffects.forEach { (visualEffect) in visualEffect.isHidden = true } + navigationController?.navigationBar.backgroundColor = .systemBackground } /// In scenarios where the content offset before content changes doesn't align with the available space after the content changes then the offset can be lost. In