From 2e24951b61cf462494bf3a9fd0679b6116f809c0 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 01:05:25 +0100 Subject: [PATCH 01/16] Move MeHeaderView to another directory --- .../ViewRelated/Me/{Me Main => Views}/Header/MeHeaderView.h | 0 .../ViewRelated/Me/{Me Main => Views}/Header/MeHeaderView.m | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename WordPress/Classes/ViewRelated/Me/{Me Main => Views}/Header/MeHeaderView.h (100%) rename WordPress/Classes/ViewRelated/Me/{Me Main => Views}/Header/MeHeaderView.m (100%) diff --git a/WordPress/Classes/ViewRelated/Me/Me Main/Header/MeHeaderView.h b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.h similarity index 100% rename from WordPress/Classes/ViewRelated/Me/Me Main/Header/MeHeaderView.h rename to WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.h diff --git a/WordPress/Classes/ViewRelated/Me/Me Main/Header/MeHeaderView.m b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.m similarity index 100% rename from WordPress/Classes/ViewRelated/Me/Me Main/Header/MeHeaderView.m rename to WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.m From 4641e7d70c1f384774b8cf48f4ab86f3d7bb7b56 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 01:05:48 +0100 Subject: [PATCH 02/16] Add Configuration type for MeHeaderView --- .../Me/Views/Header/MeHeaderView.swift | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.swift diff --git a/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.swift b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.swift new file mode 100644 index 000000000000..cce158baecf6 --- /dev/null +++ b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.swift @@ -0,0 +1,27 @@ +import UIKit + +extension MeHeaderView { + + func update(with configuration: Configuration) { + self.gravatarEmail = configuration.gravatarEmail + self.username = configuration.username + self.displayName = configuration.displayName + } + + struct Configuration { + let gravatarEmail: String? + let username: String + let displayName: String + } +} + +extension MeHeaderView.Configuration { + + init(account: WPAccount) { + self.init( + gravatarEmail: account.email, + username: account.username, + displayName: account.displayName + ) + } +} From ec2594aae27191419b738d4f59be11817e8f9992 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 01:06:20 +0100 Subject: [PATCH 03/16] Add Configuration type for SupportTableViewController --- ...ortTableViewController+Configuration.swift | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift new file mode 100644 index 000000000000..6f994f445d6a --- /dev/null +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift @@ -0,0 +1,34 @@ +import Foundation + +extension SupportTableViewController { + + struct Configuration { + + let meHeaderConfiguration: MeHeaderView.Configuration? + } +} + +extension SupportTableViewController.Configuration { + + init() { + self.init(meHeaderConfiguration: nil) + } + + static func currentAccountConfiguration() -> Self { + var meHeaderConfiguration: MeHeaderView.Configuration? + if let account = Self.makeAccount() { + meHeaderConfiguration = .init(account: account) + } + return .init(meHeaderConfiguration: meHeaderConfiguration) + } + + private static func makeAccount() -> WPAccount? { + let context = ContextManager.shared.mainContext + do { + return try WPAccount.lookupDefaultWordPressComAccount(in: context) + } catch { + DDLogError("Account lookup failed with error: \(error)") + return nil + } + } +} From 02f04a5bf328b3ea438eb9f618141a0ae3412062 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 01:07:23 +0100 Subject: [PATCH 04/16] Display Me Header in SupportTableViewController --- .../Shared/UITableView+Header.swift | 7 +++-- .../Support/SupportTableViewController.swift | 20 +++++++++++--- WordPress/WordPress.xcodeproj/project.pbxproj | 26 ++++++++++++++++--- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Site Creation/Shared/UITableView+Header.swift b/WordPress/Classes/ViewRelated/Site Creation/Shared/UITableView+Header.swift index 45ebb7d55665..9e4c28b3b6d5 100644 --- a/WordPress/Classes/ViewRelated/Site Creation/Shared/UITableView+Header.swift +++ b/WordPress/Classes/ViewRelated/Site Creation/Shared/UITableView+Header.swift @@ -42,7 +42,10 @@ extension UITableView { withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel ) - tableHeaderView.frame = CGRect(origin: .zero, size: size) - self.tableHeaderView = tableHeaderView + let newFrame = CGRect(origin: .zero, size: size) + if tableHeaderView.frame.height != newFrame.height { + tableHeaderView.frame = newFrame + self.tableHeaderView = tableHeaderView + } } } diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift index 81cf0f3e595b..0c9c73531456 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift @@ -5,6 +5,9 @@ class SupportTableViewController: UITableViewController { // MARK: - Properties + /// Configures the appearance of the support screen. + let configuration: Configuration + var sourceTag: WordPressSupportSourceTag? // If set, the Zendesk views will be shown from this view instead of in the navigation controller. @@ -21,7 +24,8 @@ class SupportTableViewController: UITableViewController { // MARK: - Init - override init(style: UITableView.Style) { + init(configuration: Configuration = .init(), style: UITableView.Style = .grouped) { + self.configuration = configuration super.init(style: style) } @@ -46,6 +50,11 @@ class SupportTableViewController: UITableViewController { ZendeskUtils.fetchUserInformation() } + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + self.tableView.sizeToFitHeaderView() + } + override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) reloadViewModel() @@ -112,9 +121,12 @@ private extension SupportTableViewController { tableHandler = ImmuTableViewHandler(takeOver: self) reloadViewModel() WPStyleGuide.configureColors(view: view, tableView: tableView) - // remove empty cells - tableView.tableFooterView = UIView() - + tableView.tableFooterView = UIView() // remove empty cells + if let headerConfig = configuration.meHeaderConfiguration { + let headerView = MeHeaderView() + headerView.update(with: headerConfig) + tableView.tableHeaderView = headerView + } registerObservers() } diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index b281182d9ac3..0d32959c750d 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -3367,6 +3367,9 @@ F465980C28E66A5B00D5F49A /* white-on-blue-icon-app-83.5@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F465980728E66A5B00D5F49A /* white-on-blue-icon-app-83.5@2x.png */; }; F4BECD1B288EE5220078391A /* SuggestionsViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4BECD1A288EE5220078391A /* SuggestionsViewModelType.swift */; }; F4BECD1C288EE5220078391A /* SuggestionsViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4BECD1A288EE5220078391A /* SuggestionsViewModelType.swift */; }; + F4CBE3D429258AE1004FFBB6 /* MeHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */; }; + F4CBE3D6292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */; }; + F4CBE3D7292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */; }; F4D9AF4F288AD2E300803D40 /* SuggestionViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D9AF4E288AD2E300803D40 /* SuggestionViewModelTests.swift */; }; F4D9AF51288AE23500803D40 /* SuggestionTableViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D9AF50288AE23500803D40 /* SuggestionTableViewTests.swift */; }; F4D9AF53288AE2BA00803D40 /* SuggestionsTableViewDelegateMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D9AF52288AE2BA00803D40 /* SuggestionsTableViewDelegateMock.swift */; }; @@ -3375,6 +3378,7 @@ F4F9D5EC29096CF500502576 /* MigrationHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F9D5EB29096CF500502576 /* MigrationHeaderView.swift */; }; F4F9D5F2290993D400502576 /* MigrationWelcomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F9D5F1290993D400502576 /* MigrationWelcomeViewModel.swift */; }; F4F9D5F42909B7C100502576 /* MigrationWelcomeBlogTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F9D5F32909B7C100502576 /* MigrationWelcomeBlogTableViewCell.swift */; }; + F4FB0ACD292587D500F651F9 /* MeHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */; }; F504D2B025D60C5900A2764C /* StoryPoster.swift in Sources */ = {isa = PBXBuildFile; fileRef = F504D2AA25D60C5900A2764C /* StoryPoster.swift */; }; F504D2B125D60C5900A2764C /* StoryMediaLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F504D2AB25D60C5900A2764C /* StoryMediaLoader.swift */; }; F504D43725D717EF00A2764C /* PostEditor+BlogPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91DCE84321A6A7840062F134 /* PostEditor+BlogPicker.swift */; }; @@ -5917,7 +5921,6 @@ 30EABE0818A5903400B73A9C /* WPBlogTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPBlogTableViewCell.m; sourceTree = ""; }; 310186691A373B01008F7DF6 /* WPTabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WPTabBarController.h; sourceTree = ""; }; 3101866A1A373B01008F7DF6 /* WPTabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WPTabBarController.m; sourceTree = ""; }; - 315FC2C31A2CB29300E7CDA2 /* MeHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MeHeaderView.h; sourceTree = ""; }; 315FC2C41A2CB29300E7CDA2 /* MeHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MeHeaderView.m; sourceTree = ""; }; 316B99031B205AFB007963EF /* WordPress 32.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "WordPress 32.xcdatamodel"; sourceTree = ""; }; 319D6E7F19E44C680013871C /* SuggestionsTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SuggestionsTableView.h; path = Suggestions/SuggestionsTableView.h; sourceTree = ""; }; @@ -8479,6 +8482,8 @@ F465980628E66A5A00D5F49A /* white-on-blue-icon-app-60@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "white-on-blue-icon-app-60@2x.png"; sourceTree = ""; }; F465980728E66A5B00D5F49A /* white-on-blue-icon-app-83.5@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "white-on-blue-icon-app-83.5@2x.png"; sourceTree = ""; }; F4BECD1A288EE5220078391A /* SuggestionsViewModelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuggestionsViewModelType.swift; sourceTree = ""; }; + F4CBE3D329258AD6004FFBB6 /* MeHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MeHeaderView.h; sourceTree = ""; }; + F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SupportTableViewController+Configuration.swift"; sourceTree = ""; }; F4D9AF4E288AD2E300803D40 /* SuggestionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionViewModelTests.swift; sourceTree = ""; }; F4D9AF50288AE23500803D40 /* SuggestionTableViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionTableViewTests.swift; sourceTree = ""; }; F4D9AF52288AE2BA00803D40 /* SuggestionsTableViewDelegateMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionsTableViewDelegateMock.swift; sourceTree = ""; }; @@ -8487,6 +8492,7 @@ F4F9D5EB29096CF500502576 /* MigrationHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationHeaderView.swift; sourceTree = ""; }; F4F9D5F1290993D400502576 /* MigrationWelcomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationWelcomeViewModel.swift; sourceTree = ""; }; F4F9D5F32909B7C100502576 /* MigrationWelcomeBlogTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationWelcomeBlogTableViewCell.swift; sourceTree = ""; }; + F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeHeaderView.swift; sourceTree = ""; }; F504D2AA25D60C5900A2764C /* StoryPoster.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryPoster.swift; sourceTree = ""; }; F504D2AB25D60C5900A2764C /* StoryMediaLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryMediaLoader.swift; sourceTree = ""; }; F50B0E7A246212B8006601DD /* NoticeAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeAnimator.swift; sourceTree = ""; }; @@ -10058,6 +10064,7 @@ 31F4F6641A13858F00196A98 /* Me */ = { isa = PBXGroup; children = ( + F4FB0ACB2925878E00F651F9 /* Views */, 3F29EB70240421F6005313DE /* Account Settings */, 3F29EB6E240420C3005313DE /* App Settings */, 3F29EB6F2404218E005313DE /* Help & Support */, @@ -10290,7 +10297,6 @@ children = ( E1A8CACA1C22FF7C0038689E /* MeViewController.swift */, 3F29EB7124042276005313DE /* MeViewController+UIViewControllerRestoration.swift */, - 3F29EB6C24042038005313DE /* Header */, 3F43602D23F31C06001DEE70 /* Presenter */, ); path = "Me Main"; @@ -10299,8 +10305,9 @@ 3F29EB6C24042038005313DE /* Header */ = { isa = PBXGroup; children = ( - 315FC2C31A2CB29300E7CDA2 /* MeHeaderView.h */, 315FC2C41A2CB29300E7CDA2 /* MeHeaderView.m */, + F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */, + F4CBE3D329258AD6004FFBB6 /* MeHeaderView.h */, ); path = Header; sourceTree = ""; @@ -13163,6 +13170,7 @@ isa = PBXGroup; children = ( 98077B592075561800109F95 /* SupportTableViewController.swift */, + F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */, ); path = Support; sourceTree = ""; @@ -16437,6 +16445,14 @@ path = Views; sourceTree = ""; }; + F4FB0ACB2925878E00F651F9 /* Views */ = { + isa = PBXGroup; + children = ( + 3F29EB6C24042038005313DE /* Header */, + ); + path = Views; + sourceTree = ""; + }; F504D2A925D60C5900A2764C /* Stories */ = { isa = PBXGroup; children = ( @@ -19631,6 +19647,7 @@ 175A650C20B6F7280023E71B /* ReaderSaveForLater+Analytics.swift in Sources */, 4054F4572214E3C800D261AB /* TagsCategoriesStatsRecordValue+CoreDataProperties.swift in Sources */, 9A2B28F52192121400458F2A /* RevisionOperation.swift in Sources */, + F4FB0ACD292587D500F651F9 /* MeHeaderView.swift in Sources */, 984B4EF320742FCC00F87888 /* ZendeskUtils.swift in Sources */, F580C3CB23D8F9B40038E243 /* AbstractPost+Dates.swift in Sources */, 982DDF90263238A6002B3904 /* LikeUser+CoreDataClass.swift in Sources */, @@ -21291,6 +21308,7 @@ 400A2C872217A985000A8A59 /* ReferrerStatsRecordValue+CoreDataProperties.swift in Sources */, 57AA848F228715DA00D3C2A2 /* PostCardCell.swift in Sources */, FE43DAAF26DFAD1C00CFF595 /* CommentContentTableViewCell.swift in Sources */, + F4CBE3D6292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */, 8F22804451E5812433733348 /* TimeZoneSearchHeaderView.swift in Sources */, 8F228F2923045666AE456D2C /* TimeZoneSelectorViewController.swift in Sources */, ); @@ -22493,6 +22511,7 @@ FE4C46FF27FAE61700285F35 /* DashboardPromptsCardCell.swift in Sources */, FABB21972602FC2C00C8785C /* MenusViewController.m in Sources */, FABB21982602FC2C00C8785C /* UIViewController+Notice.swift in Sources */, + F4CBE3D7292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */, FABB21992602FC2C00C8785C /* GutenbergFileUploadProcessor.swift in Sources */, FABB219A2602FC2C00C8785C /* EventLoggingDataProvider.swift in Sources */, FABB219B2602FC2C00C8785C /* PageListSectionHeaderView.swift in Sources */, @@ -23878,6 +23897,7 @@ FABB25EA2602FC2C00C8785C /* PeopleRoleBadgeLabel.swift in Sources */, FABB25EB2602FC2C00C8785C /* ActivityDetailViewController.swift in Sources */, FABB25EC2602FC2C00C8785C /* BlogListViewController+BlogDetailsFactory.swift in Sources */, + F4CBE3D429258AE1004FFBB6 /* MeHeaderView.swift in Sources */, C32A6A2D2832BF02002E9394 /* SiteDesignCategoryThumbnailSize.swift in Sources */, FABB25ED2602FC2C00C8785C /* WebViewControllerConfiguration.swift in Sources */, FABB25EE2602FC2C00C8785C /* ViewMoreRow.swift in Sources */, From 91e0e0c9180769871a81c4755fa98075b53c5520 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 13:46:28 +0100 Subject: [PATCH 05/16] Reuse Log Out Logic from MeViewController --- .../Support/LogOutActionHandler.swift | 38 +++++++++++++++++++ WordPress/WordPress.xcodeproj/project.pbxproj | 6 +++ 2 files changed, 44 insertions(+) create mode 100644 WordPress/Classes/ViewRelated/Support/LogOutActionHandler.swift diff --git a/WordPress/Classes/ViewRelated/Support/LogOutActionHandler.swift b/WordPress/Classes/ViewRelated/Support/LogOutActionHandler.swift new file mode 100644 index 000000000000..f9fff153f878 --- /dev/null +++ b/WordPress/Classes/ViewRelated/Support/LogOutActionHandler.swift @@ -0,0 +1,38 @@ +import UIKit + +struct LogOutActionHandler { + + func logOut(with viewController: UIViewController) { + let alert = UIAlertController(title: logOutAlertTitle, message: nil, preferredStyle: .alert) + alert.addActionWithTitle(Strings.alertCancelAction, style: .cancel) + alert.addActionWithTitle(Strings.alertLogoutAction, style: .destructive) { [weak viewController] _ in + viewController?.dismiss(animated: true) { + AccountHelper.logOutDefaultWordPressComAccount() + } + } + viewController.present(alert, animated: true) + } + + private var logOutAlertTitle: String { + let context = ContextManager.sharedInstance().mainContext + let count = AbstractPost.countLocalPosts(in: context) + + guard count > 0 else { + return Strings.alertDefaultTitle + } + + let format = count > 1 ? Strings.alertUnsavedTitlePlural : Strings.alertUnsavedTitleSingular + return String(format: format, count) + } + + + private struct Strings { + static let alertDefaultTitle = AppConstants.Logout.alertTitle + static let alertUnsavedTitleSingular = NSLocalizedString("You have changes to %d post that hasn't been uploaded to your site. Logging out now will delete those changes. Log out anyway?", + comment: "Warning displayed before logging out. The %d placeholder will contain the number of local posts (SINGULAR!)") + static let alertUnsavedTitlePlural = NSLocalizedString("You have changes to %d posts that haven’t been uploaded to your site. Logging out now will delete those changes. Log out anyway?", + comment: "Warning displayed before logging out. The %d placeholder will contain the number of local posts (PLURAL!)") + static let alertCancelAction = NSLocalizedString("Cancel", comment: "Verb. A button title. Tapping cancels an action.") + static let alertLogoutAction = NSLocalizedString("Log Out", comment: "Button for confirming logging out from WordPress.com account") + } +} diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index 0d32959c750d..90a1c0669765 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -3370,6 +3370,8 @@ F4CBE3D429258AE1004FFBB6 /* MeHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */; }; F4CBE3D6292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */; }; F4CBE3D7292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */; }; + F4CBE3D929265BC8004FFBB6 /* LogOutActionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */; }; + F4CBE3DA29265BC8004FFBB6 /* LogOutActionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */; }; F4D9AF4F288AD2E300803D40 /* SuggestionViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D9AF4E288AD2E300803D40 /* SuggestionViewModelTests.swift */; }; F4D9AF51288AE23500803D40 /* SuggestionTableViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D9AF50288AE23500803D40 /* SuggestionTableViewTests.swift */; }; F4D9AF53288AE2BA00803D40 /* SuggestionsTableViewDelegateMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D9AF52288AE2BA00803D40 /* SuggestionsTableViewDelegateMock.swift */; }; @@ -8484,6 +8486,7 @@ F4BECD1A288EE5220078391A /* SuggestionsViewModelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuggestionsViewModelType.swift; sourceTree = ""; }; F4CBE3D329258AD6004FFBB6 /* MeHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MeHeaderView.h; sourceTree = ""; }; F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SupportTableViewController+Configuration.swift"; sourceTree = ""; }; + F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogOutActionHandler.swift; sourceTree = ""; }; F4D9AF4E288AD2E300803D40 /* SuggestionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionViewModelTests.swift; sourceTree = ""; }; F4D9AF50288AE23500803D40 /* SuggestionTableViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionTableViewTests.swift; sourceTree = ""; }; F4D9AF52288AE2BA00803D40 /* SuggestionsTableViewDelegateMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionsTableViewDelegateMock.swift; sourceTree = ""; }; @@ -13171,6 +13174,7 @@ children = ( 98077B592075561800109F95 /* SupportTableViewController.swift */, F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */, + F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */, ); path = Support; sourceTree = ""; @@ -20946,6 +20950,7 @@ E6D2E1691B8AAD9B0000ED14 /* ReaderListStreamHeader.swift in Sources */, 981D092A211259840014ECAF /* NoResultsViewController+MediaLibrary.swift in Sources */, D83CA3B02084CAAF0060E310 /* StockPhotosDataLoader.swift in Sources */, + F4CBE3D929265BC8004FFBB6 /* LogOutActionHandler.swift in Sources */, E66969DA1B9E55AB00EC9C00 /* ReaderTopicToReaderTagTopic37to38.swift in Sources */, 9A4E271A22EF0C78001F6A6B /* ChangeUsernameViewModel.swift in Sources */, 172797D91CE5D0CD00CB8057 /* PlansLoadingIndicatorView.swift in Sources */, @@ -23517,6 +23522,7 @@ FABB24BF2602FC2C00C8785C /* EpilogueUserInfoCell.swift in Sources */, FABB24C02602FC2C00C8785C /* MenuItemTypeSelectionView.m in Sources */, FABB24C12602FC2C00C8785C /* WordPressAppDelegate+openURL.swift in Sources */, + F4CBE3DA29265BC8004FFBB6 /* LogOutActionHandler.swift in Sources */, FABB24C22602FC2C00C8785C /* WPSplitViewController.swift in Sources */, FABB24C32602FC2C00C8785C /* CollectionViewContainerRow.swift in Sources */, FABB24C42602FC2C00C8785C /* JetpackConnectionWebViewController.swift in Sources */, From 74eba9ddba9b3e11c8ef3f7ffbe0c5ea5e51e7ef Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 13:59:20 +0100 Subject: [PATCH 06/16] Add showsLogOutButton flag to SupportTableViewController Configuration --- ...SupportTableViewController+Configuration.swift | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift index 6f994f445d6a..35e1212221b0 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift @@ -3,23 +3,20 @@ import Foundation extension SupportTableViewController { struct Configuration { - - let meHeaderConfiguration: MeHeaderView.Configuration? + var meHeaderConfiguration: MeHeaderView.Configuration? + var showsLogOutButton: Bool = false } } extension SupportTableViewController.Configuration { - init() { - self.init(meHeaderConfiguration: nil) - } - static func currentAccountConfiguration() -> Self { - var meHeaderConfiguration: MeHeaderView.Configuration? + var config = Self.init() if let account = Self.makeAccount() { - meHeaderConfiguration = .init(account: account) + config.meHeaderConfiguration = .init(account: account) + config.showsLogOutButton = true } - return .init(meHeaderConfiguration: meHeaderConfiguration) + return config } private static func makeAccount() -> WPAccount? { From 5cb78c88bf4fd175a99356d69b34a5aa9aa5721b Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 13:59:55 +0100 Subject: [PATCH 07/16] Hide or show log out button depending on the showsLogOutButton flag --- .../Support/SupportTableViewController.swift | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift index 0c9c73531456..64d3ee1c9758 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift @@ -116,6 +116,7 @@ private extension SupportTableViewController { NavigationItemRow.self, TextRow.self, HelpRow.self, + DestructiveButtonRow.self, SupportEmailRow.self], tableView: tableView) tableHandler = ImmuTableViewHandler(takeOver: self) @@ -167,8 +168,20 @@ private extension SupportTableViewController { rows: [versionRow, switchRow, logsRow], footerText: LocalizedText.informationFooter) + // Log out sections + var logOutSections: ImmuTableSection? + if configuration.showsLogOutButton { + let logOutRow = DestructiveButtonRow( + title: LocalizedText.logOutButtonTitle, + action: logOutTapped(), + accessibilityIdentifier: "" + ) + logOutSections = .init(headerText: LocalizedText.wpAccount, optionalRows: [logOutRow]) + } + // Create and return table - return ImmuTable(sections: [helpSection, informationSection]) + let sections = [helpSection, informationSection, logOutSections].compactMap { $0 } + return ImmuTable(sections: sections) } @objc func refreshNotificationIndicator(_ notification: Foundation.Notification) { @@ -286,6 +299,17 @@ private extension SupportTableViewController { } } + private func logOutTapped() -> ImmuTableAction { + return { [weak self] row in + guard let self else { + return + } + self.tableView.deselectSelectedRowWithAnimation(true) + let actionHandler = LogOutActionHandler() + actionHandler.logOut(with: self) + } + } + // MARK: - ImmuTableRow Struct struct HelpRow: ImmuTableRow { @@ -357,6 +381,8 @@ private extension SupportTableViewController { static let contactEmail = NSLocalizedString("Contact Email", comment: "Support email label.") static let contactEmailAccessibilityHint = NSLocalizedString("Shows a dialog for changing the Contact Email.", comment: "Accessibility hint describing what happens if the Contact Email button is tapped.") static let emailNotSet = NSLocalizedString("Not Set", comment: "Display value for Support email field if there is no user email address.") + static let wpAccount = NSLocalizedString("WordPress.com Account", comment: "WordPress.com sign-out section header title") + static let logOutButtonTitle = NSLocalizedString("Log Out", comment: "Button for confirming logging out from WordPress.com account") } // MARK: - User Defaults Keys From 82a44729d2a8b1c4133581f9a1b6bbba44b4abf7 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 14:04:12 +0100 Subject: [PATCH 08/16] Add showsLogsSection flag to hide / show support information sections --- ...ortTableViewController+Configuration.swift | 2 ++ .../Support/SupportTableViewController.swift | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift index 35e1212221b0..68b7e69fd39b 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift @@ -5,6 +5,7 @@ extension SupportTableViewController { struct Configuration { var meHeaderConfiguration: MeHeaderView.Configuration? var showsLogOutButton: Bool = false + var showsLogsSection: Bool = true } } @@ -15,6 +16,7 @@ extension SupportTableViewController.Configuration { if let account = Self.makeAccount() { config.meHeaderConfiguration = .init(account: account) config.showsLogOutButton = true + config.showsLogsSection = false } return config } diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift index 64d3ee1c9758..7f329ff1d1a5 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift @@ -157,16 +157,19 @@ private extension SupportTableViewController { footerText: LocalizedText.helpFooter) // Information Section - let versionRow = TextRow(title: LocalizedText.version, value: Bundle.main.shortVersionString()) - let switchRow = SwitchRow(title: LocalizedText.extraDebug, - value: userDefaults.bool(forKey: UserDefaultsKeys.extraDebug), - onChange: extraDebugToggled()) - let logsRow = NavigationItemRow(title: LocalizedText.activityLogs, action: activityLogsSelected(), accessibilityIdentifier: "activity-logs-button") - - let informationSection = ImmuTableSection( - headerText: nil, - rows: [versionRow, switchRow, logsRow], - footerText: LocalizedText.informationFooter) + var informationSection: ImmuTableSection? + if configuration.showsLogsSection { + let versionRow = TextRow(title: LocalizedText.version, value: Bundle.main.shortVersionString()) + let switchRow = SwitchRow(title: LocalizedText.extraDebug, + value: userDefaults.bool(forKey: UserDefaultsKeys.extraDebug), + onChange: extraDebugToggled()) + let logsRow = NavigationItemRow(title: LocalizedText.activityLogs, action: activityLogsSelected(), accessibilityIdentifier: "activity-logs-button") + informationSection = ImmuTableSection( + headerText: nil, + rows: [versionRow, switchRow, logsRow], + footerText: LocalizedText.informationFooter + ) + } // Log out sections var logOutSections: ImmuTableSection? From b489bf168db625012c4516ac3f2dcea1fe13204e Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 16:55:03 +0100 Subject: [PATCH 09/16] Progress presenting the support screen from the migration flow --- .../Support/SupportTableViewController.swift | 2 +- .../Classes/System/JetpackWindowManager.swift | 2 +- .../Common/MigrationDependencyContainer.swift | 4 +++ .../Navigation/MigrationFlowCoordinator.swift | 3 +++ .../MigrationNavigationController.swift | 19 ++++++++++++- .../Welcome/MigrationWelcomeViewModel.swift | 27 +++++++++++++++---- 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift index 7f329ff1d1a5..58a8a3b19a28 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift @@ -171,7 +171,7 @@ private extension SupportTableViewController { ) } - // Log out sections + // Log out Section var logOutSections: ImmuTableSection? if configuration.showsLogOutButton { let logOutRow = DestructiveButtonRow( diff --git a/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift b/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift index ae05026d55bb..510388966881 100644 --- a/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift +++ b/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift @@ -43,6 +43,6 @@ class JetpackWindowManager: WindowManager { // TODO: Add logic in here to trigger migration UI if needed private var shouldShowMigrationUI: Bool { - false + true } } diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift index f37424fb1a17..cc220641aaa1 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift @@ -44,10 +44,14 @@ struct MigrationViewControllerFactory { } } + // MARK: - View Models + private func makeWelcomeViewModel() -> MigrationWelcomeViewModel { MigrationWelcomeViewModel(account: makeAccount(), coordinator: coordinator) } + // MARK: - View Controllers + private func makeWelcomeViewController() -> UIViewController { MigrationWelcomeViewController(viewModel: makeWelcomeViewModel()) } diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift index 6bf3a0d8e589..bcb53127d24e 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift @@ -8,6 +8,9 @@ final class MigrationFlowCoordinator: ObservableObject { // related to this property. @Published private(set) var currentStep = MigrationStep.welcome + /// Call this closure to display the support screen + var routeToSupportViewController: (() -> Void)? + func transitionToNextStep() { Task { [weak self] in if let nextStep = await Self.nextStep(from: currentStep) { diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift index ee334108bfb7..11dbefc8a6f1 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift @@ -2,6 +2,9 @@ import Combine import UIKit class MigrationNavigationController: UINavigationController { + + // MARK: - Properties + /// Navigation coordinator private let coordinator: MigrationFlowCoordinator /// The view controller factory used to push view controllers on the stack @@ -9,6 +12,8 @@ class MigrationNavigationController: UINavigationController { /// Receives state changes to set the navigation stack accordingly private var cancellable: AnyCancellable? + // MARK: - Orientation + override var supportedInterfaceOrientations: UIInterfaceOrientationMask { if WPDeviceIdentification.isiPhone() { return .portrait @@ -21,6 +26,8 @@ class MigrationNavigationController: UINavigationController { .portrait } + // MARK: - Init + init(coordinator: MigrationFlowCoordinator, factory: MigrationViewControllerFactory) { self.coordinator = coordinator self.factory = factory @@ -36,6 +43,8 @@ class MigrationNavigationController: UINavigationController { fatalError("init(coder:) has not been implemented") } + // MARK: - Configuration + private func configure() { let navigationBar = self.navigationBar let standardAppearance = UINavigationBarAppearance() @@ -49,7 +58,15 @@ class MigrationNavigationController: UINavigationController { navigationBar.compactScrollEdgeAppearance = scrollEdgeAppearance } navigationBar.isTranslucent = true - listenForStateChanges() + configure(coordinator: coordinator) + } + + private func configure(coordinator: MigrationFlowCoordinator) { + coordinator.routeToSupportViewController = { [weak self] in + let destination = SupportTableViewController(configuration: .currentAccountConfiguration()) + self?.present(UINavigationController(rootViewController: destination), animated: true) + } + self.listenForStateChanges() } private func listenForStateChanges() { diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift index 1c267c0f62c6..eb6f47f9171d 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift @@ -24,12 +24,29 @@ final class MigrationWelcomeViewModel { let headerConfiguration = MigrationHeaderConfiguration(step: .welcome, multiSite: blogListDataSource.visibleBlogsCount > 1) - let actionsConfiguration = MigrationActionsViewConfiguration(step: .welcome, - primaryHandler: { [weak coordinator] in + let primaryHandler = { [weak coordinator] () -> Void in coordinator?.transitionToNextStep() - }, - secondaryHandler: { }) - + } + let secondaryHandler = { [weak coordinator] () -> Void in + // Which object is responsible for displaying the support screen? + // + // The following code needs to be executed somewhere: + // + // let destination = SupportTableViewController() + // presentingViewController.present(destination, completion: nil) + // + // Approaches considered: + // + // 1. The View Model shouldn't be responsible for displaying the support screen + // 2. The coordination can't perform the presentation because it doesn't have access to the `presenting` view controller + // 3. I thought of making the `MigrationViewControllerFactory` responsible for creating the `secondaryHandler` and injecting it into this view model + // But that didn't work as well. + // + // Workaround: + // + coordinator?.routeToSupportViewController?() + } + let actionsConfiguration = MigrationActionsViewConfiguration(step: .welcome, primaryHandler: primaryHandler, secondaryHandler: secondaryHandler) configuration = MigrationStepConfiguration(headerConfiguration: headerConfiguration, actionsConfiguration: actionsConfiguration) } } From 3a3f5192b21eab10efd6c4353df3dbf4b06cb3e9 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 17 Nov 2022 18:39:08 +0100 Subject: [PATCH 10/16] Add Support Screen presentation logic --- .../Common/MigrationDependencyContainer.swift | 43 ++++++++++-- .../Navigation/MigrationFlowCoordinator.swift | 3 - .../MigrationNavigationController.swift | 10 +-- .../MigrationWelcomeViewController.swift | 4 +- .../Welcome/MigrationWelcomeViewModel.swift | 66 +++++++------------ 5 files changed, 66 insertions(+), 60 deletions(-) diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift index cc220641aaa1..11d23ddce91d 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift @@ -44,16 +44,30 @@ struct MigrationViewControllerFactory { } } - // MARK: - View Models + // MARK: - View Controllers - private func makeWelcomeViewModel() -> MigrationWelcomeViewModel { - MigrationWelcomeViewModel(account: makeAccount(), coordinator: coordinator) + private func makeWelcomeViewModel(handlers: ActionHandlers) -> MigrationWelcomeViewModel { + let primaryHandler = { () -> Void in handlers.primary?() } + let secondaryHandler = { () -> Void in handlers.secondary?() } + + let actions = MigrationActionsViewConfiguration( + step: .welcome, + primaryHandler: primaryHandler, + secondaryHandler: secondaryHandler + ) + + return .init(account: makeAccount(), actions: actions) } - // MARK: - View Controllers - private func makeWelcomeViewController() -> UIViewController { - MigrationWelcomeViewController(viewModel: makeWelcomeViewModel()) + let handlers = ActionHandlers() + let viewModel = makeWelcomeViewModel(handlers: handlers) + + let viewController = MigrationWelcomeViewController(viewModel: viewModel) + handlers.primary = { [weak coordinator] in coordinator?.transitionToNextStep() } + handlers.secondary = makeSupportViewControllerRouter(with: viewController) + + return viewController } private func makeNotificationsViewModel() -> MigrationNotificationsViewModel { @@ -71,4 +85,21 @@ struct MigrationViewControllerFactory { private func makeDoneViewController() -> UIViewController { MigrationDoneViewController(viewModel: makeDoneViewModel()) } + + // MARK: - Routers + + private func makeSupportViewControllerRouter(with presenter: UIViewController) -> () -> Void { + return { [weak presenter] in + let destination = SupportTableViewController(configuration: .currentAccountConfiguration()) + presenter?.present(UINavigationController(rootViewController: destination), animated: true) + } + } + + // MARK: - Types + + private class ActionHandlers { + var primary: (() -> Void)? + var secondary: (() -> Void)? + } + } diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift index bcb53127d24e..6bf3a0d8e589 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationFlowCoordinator.swift @@ -8,9 +8,6 @@ final class MigrationFlowCoordinator: ObservableObject { // related to this property. @Published private(set) var currentStep = MigrationStep.welcome - /// Call this closure to display the support screen - var routeToSupportViewController: (() -> Void)? - func transitionToNextStep() { Task { [weak self] in if let nextStep = await Self.nextStep(from: currentStep) { diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift index 11dbefc8a6f1..9095db1e91c6 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift @@ -58,15 +58,7 @@ class MigrationNavigationController: UINavigationController { navigationBar.compactScrollEdgeAppearance = scrollEdgeAppearance } navigationBar.isTranslucent = true - configure(coordinator: coordinator) - } - - private func configure(coordinator: MigrationFlowCoordinator) { - coordinator.routeToSupportViewController = { [weak self] in - let destination = SupportTableViewController(configuration: .currentAccountConfiguration()) - self?.present(UINavigationController(rootViewController: destination), animated: true) - } - self.listenForStateChanges() + listenForStateChanges() } private func listenForStateChanges() { diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewController.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewController.swift index a3d20166d9b6..4c214c450697 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewController.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewController.swift @@ -65,7 +65,9 @@ final class MigrationWelcomeViewController: UIViewController { } private func setupNavigationBar() { - self.navigationItem.rightBarButtonItem = UIBarButtonItem(email: viewModel.gravatarEmail) + self.navigationItem.rightBarButtonItem = UIBarButtonItem(email: viewModel.gravatarEmail) { [weak self] () -> Void in + self?.viewModel.configuration.actionsConfiguration.secondaryHandler?() + } } private func setupBottomSheet() { diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift index e1615d9ebe90..9d63a7dad152 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewModel.swift @@ -4,51 +4,35 @@ final class MigrationWelcomeViewModel { // MARK: - Properties - var gravatarEmail: String? - - let blogListDataSource: BlogListDataSource - + let gravatarEmail: String? let configuration: MigrationStepConfiguration + let blogListDataSource: BlogListDataSource // MARK: - Init - init(account: WPAccount?, coordinator: MigrationFlowCoordinator) { - if let account { - self.gravatarEmail = account.email - } - - self.blogListDataSource = BlogListDataSource() - self.blogListDataSource.loggedIn = true - self.blogListDataSource.account = account - - let headerConfiguration = MigrationHeaderConfiguration(step: .welcome, - multiSite: blogListDataSource.visibleBlogsCount > 1) + init(gravatarEmail: String?, blogListDataSource: BlogListDataSource, configuration: MigrationStepConfiguration) { + self.gravatarEmail = gravatarEmail + self.configuration = configuration + self.blogListDataSource = blogListDataSource + } - let primaryHandler = { [weak coordinator] () -> Void in - coordinator?.transitionToNextStep() - } - let secondaryHandler = { [weak coordinator] () -> Void in - // Which object is responsible for displaying the support screen? - // - // The following code needs to be executed somewhere: - // - // let destination = SupportTableViewController() - // presentingViewController.present(destination, completion: nil) - // - // Approaches considered: - // - // 1. The View Model shouldn't be responsible for displaying the support screen - // 2. The coordination can't perform the presentation because it doesn't have access to the `presenting` view controller - // 3. I thought of making the `MigrationViewControllerFactory` responsible for creating the `secondaryHandler` and injecting it into this view model - // But that didn't work as well. - // - // Workaround: - // - coordinator?.routeToSupportViewController?() - } - let actionsConfiguration = MigrationActionsViewConfiguration(step: .welcome, primaryHandler: primaryHandler, secondaryHandler: secondaryHandler) - configuration = MigrationStepConfiguration(headerConfiguration: headerConfiguration, - centerViewConfiguration: nil, - actionsConfiguration: actionsConfiguration) + convenience init(account: WPAccount?, actions: MigrationActionsViewConfiguration) { + let blogsDataSource = BlogListDataSource() + blogsDataSource.loggedIn = true + blogsDataSource.account = account + let header = MigrationHeaderConfiguration( + step: .welcome, + multiSite: blogsDataSource.visibleBlogsCount > 1 + ) + let configuration = MigrationStepConfiguration( + headerConfiguration: header, + centerViewConfiguration: nil, + actionsConfiguration: actions + ) + self.init( + gravatarEmail: account?.email, + blogListDataSource: blogsDataSource, + configuration: configuration + ) } } From 56cad8fb1b3d7663ec230983671770535194d553 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Fri, 18 Nov 2022 14:59:57 +0100 Subject: [PATCH 11/16] Revert MigrationNavigationController and Podfile.lock changes --- Podfile.lock | 16 ++++++++-------- .../MigrationNavigationController.swift | 9 --------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index c6117230a9f4..2bf5073dc486 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -64,15 +64,15 @@ PODS: - RNTAztecView - JTAppleCalendar (8.0.3) - Kanvas (1.4.4) - - libwebp (1.2.4): - - libwebp/demux (= 1.2.4) - - libwebp/mux (= 1.2.4) - - libwebp/webp (= 1.2.4) - - libwebp/demux (1.2.4): + - libwebp (1.2.3): + - libwebp/demux (= 1.2.3) + - libwebp/mux (= 1.2.3) + - libwebp/webp (= 1.2.3) + - libwebp/demux (1.2.3): - libwebp/webp - - libwebp/mux (1.2.4): + - libwebp/mux (1.2.3): - libwebp/demux - - libwebp/webp (1.2.4) + - libwebp/webp (1.2.3) - MediaEditor (1.2.1): - CropViewController (~> 2.5.3) - MRProgress (0.8.3): @@ -807,7 +807,7 @@ SPEC CHECKSUMS: Gutenberg: 387b010e396588027538e351899bf1cc730a7009 JTAppleCalendar: 932cadea40b1051beab10f67843451d48ba16c99 Kanvas: f932eaed3d3f47aae8aafb6c2d27c968bdd49030 - libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef + libwebp: 60305b2e989864154bd9be3d772730f08fc6a59c MediaEditor: 20cdeb46bdecd040b8bc94467ac85a52b53b193a MRProgress: 16de7cc9f347e8846797a770db102a323fe7ef09 NSObject-SafeExpectations: ab8fe623d36b25aa1f150affa324e40a2f3c0374 diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift index 9095db1e91c6..ee334108bfb7 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift @@ -2,9 +2,6 @@ import Combine import UIKit class MigrationNavigationController: UINavigationController { - - // MARK: - Properties - /// Navigation coordinator private let coordinator: MigrationFlowCoordinator /// The view controller factory used to push view controllers on the stack @@ -12,8 +9,6 @@ class MigrationNavigationController: UINavigationController { /// Receives state changes to set the navigation stack accordingly private var cancellable: AnyCancellable? - // MARK: - Orientation - override var supportedInterfaceOrientations: UIInterfaceOrientationMask { if WPDeviceIdentification.isiPhone() { return .portrait @@ -26,8 +21,6 @@ class MigrationNavigationController: UINavigationController { .portrait } - // MARK: - Init - init(coordinator: MigrationFlowCoordinator, factory: MigrationViewControllerFactory) { self.coordinator = coordinator self.factory = factory @@ -43,8 +36,6 @@ class MigrationNavigationController: UINavigationController { fatalError("init(coder:) has not been implemented") } - // MARK: - Configuration - private func configure() { let navigationBar = self.navigationBar let standardAppearance = UINavigationBarAppearance() From 94c4576f03d4697d8816f5ce3fd856e4b85c151c Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Fri, 18 Nov 2022 15:07:13 +0100 Subject: [PATCH 12/16] Fix trailing whitespace violation --- .../Common/MigrationDependencyContainer.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift index 11d23ddce91d..b6679e85dba7 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift @@ -55,7 +55,8 @@ struct MigrationViewControllerFactory { primaryHandler: primaryHandler, secondaryHandler: secondaryHandler ) - + + return .init(account: makeAccount(), actions: actions) } From abb923f7a3405c0bdd68c42fd76c6470d09d2cfd Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Fri, 18 Nov 2022 15:20:47 +0100 Subject: [PATCH 13/16] Display support screen with insetGrouped style --- .../Common/MigrationDependencyContainer.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift index b6679e85dba7..e5715b52ce2a 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift @@ -56,7 +56,6 @@ struct MigrationViewControllerFactory { secondaryHandler: secondaryHandler ) - return .init(account: makeAccount(), actions: actions) } @@ -91,7 +90,7 @@ struct MigrationViewControllerFactory { private func makeSupportViewControllerRouter(with presenter: UIViewController) -> () -> Void { return { [weak presenter] in - let destination = SupportTableViewController(configuration: .currentAccountConfiguration()) + let destination = SupportTableViewController(configuration: .currentAccountConfiguration(), style: .insetGrouped) presenter?.present(UINavigationController(rootViewController: destination), animated: true) } } @@ -102,5 +101,4 @@ struct MigrationViewControllerFactory { var primary: (() -> Void)? var secondary: (() -> Void)? } - } From f6f51b7684a2736a2d3aa58d01899f12142dc3fa Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Fri, 18 Nov 2022 15:47:51 +0100 Subject: [PATCH 14/16] Revert shouldShowMigrationUI to false --- WordPress/Jetpack/Classes/System/JetpackWindowManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift b/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift index 510388966881..ae05026d55bb 100644 --- a/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift +++ b/WordPress/Jetpack/Classes/System/JetpackWindowManager.swift @@ -43,6 +43,6 @@ class JetpackWindowManager: WindowManager { // TODO: Add logic in here to trigger migration UI if needed private var shouldShowMigrationUI: Bool { - true + false } } From 69738d047039ded205e183e29d8d785fc35ef4a3 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Mon, 21 Nov 2022 14:44:22 +0100 Subject: [PATCH 15/16] Force portrait orientation for migration screens only --- .../Navigation/MigrationNavigationController.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift index ee334108bfb7..a0567d625138 100644 --- a/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift +++ b/WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Common/Navigation/MigrationNavigationController.swift @@ -10,6 +10,9 @@ class MigrationNavigationController: UINavigationController { private var cancellable: AnyCancellable? override var supportedInterfaceOrientations: UIInterfaceOrientationMask { + if let presentedViewController { + return presentedViewController.supportedInterfaceOrientations + } if WPDeviceIdentification.isiPhone() { return .portrait } else { @@ -17,8 +20,12 @@ class MigrationNavigationController: UINavigationController { } } + // Force portrait orientation for migration view controllers only override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { - .portrait + if let presentedViewController { + return presentedViewController.preferredInterfaceOrientationForPresentation + } + return .portrait } init(coordinator: MigrationFlowCoordinator, factory: MigrationViewControllerFactory) { From 4417b15780609f1f3da7a8a0d00bbcd04bc55791 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Mon, 21 Nov 2022 16:21:13 +0100 Subject: [PATCH 16/16] Move Configuration types outside their parent type --- ....swift => MeHeaderViewConfiguration.swift} | 29 ++++++++++--------- .../Support/SupportTableViewController.swift | 1 - ...ortTableViewControllerConfiguration.swift} | 20 ++++++++----- WordPress/WordPress.xcodeproj/project.pbxproj | 24 +++++++-------- 4 files changed, 40 insertions(+), 34 deletions(-) rename WordPress/Classes/ViewRelated/Me/Views/Header/{MeHeaderView.swift => MeHeaderViewConfiguration.swift} (67%) rename WordPress/Classes/ViewRelated/Support/{SupportTableViewController+Configuration.swift => SupportTableViewControllerConfiguration.swift} (69%) diff --git a/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.swift b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderViewConfiguration.swift similarity index 67% rename from WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.swift rename to WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderViewConfiguration.swift index cce158baecf6..0380f233acb3 100644 --- a/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderView.swift +++ b/WordPress/Classes/ViewRelated/Me/Views/Header/MeHeaderViewConfiguration.swift @@ -1,21 +1,13 @@ import UIKit -extension MeHeaderView { +struct MeHeaderViewConfiguration { - func update(with configuration: Configuration) { - self.gravatarEmail = configuration.gravatarEmail - self.username = configuration.username - self.displayName = configuration.displayName - } - - struct Configuration { - let gravatarEmail: String? - let username: String - let displayName: String - } + let gravatarEmail: String? + let username: String + let displayName: String } -extension MeHeaderView.Configuration { +extension MeHeaderViewConfiguration { init(account: WPAccount) { self.init( @@ -25,3 +17,14 @@ extension MeHeaderView.Configuration { ) } } + +extension MeHeaderView { + + func update(with configuration: Configuration) { + self.gravatarEmail = configuration.gravatarEmail + self.username = configuration.username + self.displayName = configuration.displayName + } + + typealias Configuration = MeHeaderViewConfiguration +} diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift index 58a8a3b19a28..f4c992c584d0 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift @@ -87,7 +87,6 @@ class SupportTableViewController: UITableViewController { dismissTapped?() dismiss(animated: true) } - } // MARK: - Private Extension diff --git a/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift b/WordPress/Classes/ViewRelated/Support/SupportTableViewControllerConfiguration.swift similarity index 69% rename from WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift rename to WordPress/Classes/ViewRelated/Support/SupportTableViewControllerConfiguration.swift index 68b7e69fd39b..9b2c93160814 100644 --- a/WordPress/Classes/ViewRelated/Support/SupportTableViewController+Configuration.swift +++ b/WordPress/Classes/ViewRelated/Support/SupportTableViewControllerConfiguration.swift @@ -1,15 +1,14 @@ import Foundation -extension SupportTableViewController { +struct SupportTableViewControllerConfiguration { - struct Configuration { - var meHeaderConfiguration: MeHeaderView.Configuration? - var showsLogOutButton: Bool = false - var showsLogsSection: Bool = true - } -} + // MARK: Properties + + var meHeaderConfiguration: MeHeaderView.Configuration? + var showsLogOutButton: Bool = false + var showsLogsSection: Bool = true -extension SupportTableViewController.Configuration { + // MARK: Default Configurations static func currentAccountConfiguration() -> Self { var config = Self.init() @@ -31,3 +30,8 @@ extension SupportTableViewController.Configuration { } } } + +extension SupportTableViewController { + + typealias Configuration = SupportTableViewControllerConfiguration +} diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index d9058b0f8dcb..d94e1dd03ef9 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -3390,9 +3390,9 @@ F465980C28E66A5B00D5F49A /* white-on-blue-icon-app-83.5@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F465980728E66A5B00D5F49A /* white-on-blue-icon-app-83.5@2x.png */; }; F4BECD1B288EE5220078391A /* SuggestionsViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4BECD1A288EE5220078391A /* SuggestionsViewModelType.swift */; }; F4BECD1C288EE5220078391A /* SuggestionsViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4BECD1A288EE5220078391A /* SuggestionsViewModelType.swift */; }; - F4CBE3D429258AE1004FFBB6 /* MeHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */; }; - F4CBE3D6292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */; }; - F4CBE3D7292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */; }; + F4CBE3D429258AE1004FFBB6 /* MeHeaderViewConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB0ACC292587D500F651F9 /* MeHeaderViewConfiguration.swift */; }; + F4CBE3D6292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift */; }; + F4CBE3D7292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D5292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift */; }; F4CBE3D929265BC8004FFBB6 /* LogOutActionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */; }; F4CBE3DA29265BC8004FFBB6 /* LogOutActionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */; }; F4D9AF4F288AD2E300803D40 /* SuggestionViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D9AF4E288AD2E300803D40 /* SuggestionViewModelTests.swift */; }; @@ -3403,7 +3403,7 @@ F4F9D5EC29096CF500502576 /* MigrationHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F9D5EB29096CF500502576 /* MigrationHeaderView.swift */; }; F4F9D5F2290993D400502576 /* MigrationWelcomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F9D5F1290993D400502576 /* MigrationWelcomeViewModel.swift */; }; F4F9D5F42909B7C100502576 /* MigrationWelcomeBlogTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4F9D5F32909B7C100502576 /* MigrationWelcomeBlogTableViewCell.swift */; }; - F4FB0ACD292587D500F651F9 /* MeHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */; }; + F4FB0ACD292587D500F651F9 /* MeHeaderViewConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FB0ACC292587D500F651F9 /* MeHeaderViewConfiguration.swift */; }; F504D2B025D60C5900A2764C /* StoryPoster.swift in Sources */ = {isa = PBXBuildFile; fileRef = F504D2AA25D60C5900A2764C /* StoryPoster.swift */; }; F504D2B125D60C5900A2764C /* StoryMediaLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F504D2AB25D60C5900A2764C /* StoryMediaLoader.swift */; }; F504D43725D717EF00A2764C /* PostEditor+BlogPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91DCE84321A6A7840062F134 /* PostEditor+BlogPicker.swift */; }; @@ -8523,7 +8523,7 @@ F465980728E66A5B00D5F49A /* white-on-blue-icon-app-83.5@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "white-on-blue-icon-app-83.5@2x.png"; sourceTree = ""; }; F4BECD1A288EE5220078391A /* SuggestionsViewModelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuggestionsViewModelType.swift; sourceTree = ""; }; F4CBE3D329258AD6004FFBB6 /* MeHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MeHeaderView.h; sourceTree = ""; }; - F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SupportTableViewController+Configuration.swift"; sourceTree = ""; }; + F4CBE3D5292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportTableViewControllerConfiguration.swift; sourceTree = ""; }; F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogOutActionHandler.swift; sourceTree = ""; }; F4D9AF4E288AD2E300803D40 /* SuggestionViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionViewModelTests.swift; sourceTree = ""; }; F4D9AF50288AE23500803D40 /* SuggestionTableViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuggestionTableViewTests.swift; sourceTree = ""; }; @@ -8533,7 +8533,7 @@ F4F9D5EB29096CF500502576 /* MigrationHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationHeaderView.swift; sourceTree = ""; }; F4F9D5F1290993D400502576 /* MigrationWelcomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationWelcomeViewModel.swift; sourceTree = ""; }; F4F9D5F32909B7C100502576 /* MigrationWelcomeBlogTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationWelcomeBlogTableViewCell.swift; sourceTree = ""; }; - F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeHeaderView.swift; sourceTree = ""; }; + F4FB0ACC292587D500F651F9 /* MeHeaderViewConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeHeaderViewConfiguration.swift; sourceTree = ""; }; F504D2AA25D60C5900A2764C /* StoryPoster.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryPoster.swift; sourceTree = ""; }; F504D2AB25D60C5900A2764C /* StoryMediaLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryMediaLoader.swift; sourceTree = ""; }; F50B0E7A246212B8006601DD /* NoticeAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoticeAnimator.swift; sourceTree = ""; }; @@ -10347,7 +10347,7 @@ isa = PBXGroup; children = ( 315FC2C41A2CB29300E7CDA2 /* MeHeaderView.m */, - F4FB0ACC292587D500F651F9 /* MeHeaderView.swift */, + F4FB0ACC292587D500F651F9 /* MeHeaderViewConfiguration.swift */, F4CBE3D329258AD6004FFBB6 /* MeHeaderView.h */, ); path = Header; @@ -13240,7 +13240,7 @@ isa = PBXGroup; children = ( 98077B592075561800109F95 /* SupportTableViewController.swift */, - F4CBE3D5292597E3004FFBB6 /* SupportTableViewController+Configuration.swift */, + F4CBE3D5292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift */, F4CBE3D829265BC8004FFBB6 /* LogOutActionHandler.swift */, ); path = Support; @@ -19725,7 +19725,7 @@ 175A650C20B6F7280023E71B /* ReaderSaveForLater+Analytics.swift in Sources */, 4054F4572214E3C800D261AB /* TagsCategoriesStatsRecordValue+CoreDataProperties.swift in Sources */, 9A2B28F52192121400458F2A /* RevisionOperation.swift in Sources */, - F4FB0ACD292587D500F651F9 /* MeHeaderView.swift in Sources */, + F4FB0ACD292587D500F651F9 /* MeHeaderViewConfiguration.swift in Sources */, 984B4EF320742FCC00F87888 /* ZendeskUtils.swift in Sources */, F580C3CB23D8F9B40038E243 /* AbstractPost+Dates.swift in Sources */, 982DDF90263238A6002B3904 /* LikeUser+CoreDataClass.swift in Sources */, @@ -21390,7 +21390,7 @@ 400A2C872217A985000A8A59 /* ReferrerStatsRecordValue+CoreDataProperties.swift in Sources */, 57AA848F228715DA00D3C2A2 /* PostCardCell.swift in Sources */, FE43DAAF26DFAD1C00CFF595 /* CommentContentTableViewCell.swift in Sources */, - F4CBE3D6292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */, + F4CBE3D6292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift in Sources */, 8F22804451E5812433733348 /* TimeZoneSearchHeaderView.swift in Sources */, 8F228F2923045666AE456D2C /* TimeZoneSelectorViewController.swift in Sources */, ); @@ -22602,7 +22602,7 @@ FE4C46FF27FAE61700285F35 /* DashboardPromptsCardCell.swift in Sources */, FABB21972602FC2C00C8785C /* MenusViewController.m in Sources */, FABB21982602FC2C00C8785C /* UIViewController+Notice.swift in Sources */, - F4CBE3D7292597E3004FFBB6 /* SupportTableViewController+Configuration.swift in Sources */, + F4CBE3D7292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift in Sources */, FABB21992602FC2C00C8785C /* GutenbergFileUploadProcessor.swift in Sources */, FABB219A2602FC2C00C8785C /* EventLoggingDataProvider.swift in Sources */, FABB219B2602FC2C00C8785C /* PageListSectionHeaderView.swift in Sources */, @@ -23994,7 +23994,7 @@ FABB25EA2602FC2C00C8785C /* PeopleRoleBadgeLabel.swift in Sources */, FABB25EB2602FC2C00C8785C /* ActivityDetailViewController.swift in Sources */, FABB25EC2602FC2C00C8785C /* BlogListViewController+BlogDetailsFactory.swift in Sources */, - F4CBE3D429258AE1004FFBB6 /* MeHeaderView.swift in Sources */, + F4CBE3D429258AE1004FFBB6 /* MeHeaderViewConfiguration.swift in Sources */, C32A6A2D2832BF02002E9394 /* SiteDesignCategoryThumbnailSize.swift in Sources */, FABB25ED2602FC2C00C8785C /* WebViewControllerConfiguration.swift in Sources */, FABB25EE2602FC2C00C8785C /* ViewMoreRow.swift in Sources */,