From abbf4258cf2b8c69ce152ef082de2ef6c345854f Mon Sep 17 00:00:00 2001 From: Giorgio Ruscigno Date: Mon, 9 May 2022 15:36:11 -0500 Subject: [PATCH 1/2] Update SitePickerViewController, add observer for title changes in order to update site title when it changes elsewhere --- .../SitePickerViewController.swift | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Blog/Site Picker/SitePickerViewController.swift b/WordPress/Classes/ViewRelated/Blog/Site Picker/SitePickerViewController.swift index e1c1c5fa1077..1be43acc569a 100644 --- a/WordPress/Classes/ViewRelated/Blog/Site Picker/SitePickerViewController.swift +++ b/WordPress/Classes/ViewRelated/Blog/Site Picker/SitePickerViewController.swift @@ -45,6 +45,7 @@ final class SitePickerViewController: UIViewController { super.viewDidLoad() setupHeaderView() startObservingQuickStart() + startObservingTitleChanges() } deinit { @@ -57,6 +58,15 @@ final class SitePickerViewController: UIViewController { view.addSubview(blogDetailHeaderView) view.pinSubviewToAllEdges(blogDetailHeaderView) } + + private func startObservingTitleChanges() { + NotificationCenter.default.addObserver(forName: NSNotification.Name.WPBlogUpdated, + object: nil, + queue: .main) { [weak self] _ in + + self?.updateTitles() + } + } } // MARK: - BlogDetailHeaderViewDelegate @@ -191,7 +201,6 @@ extension SitePickerViewController { silentlyForBlog: blog) blogService.updateSettings(for: blog, success: { [weak self] in - NotificationCenter.default.post(name: NSNotification.Name.WPBlogUpdated, object: nil) let notice = Notice(title: title, message: SiteTitleStrings.titleChangeSuccessfulMessage, @@ -199,14 +208,7 @@ extension SitePickerViewController { ActionDispatcher.global.dispatch(NoticeAction.post(notice)) self?.blogDetailHeaderView.setTitleLoading(false) - self?.blogDetailHeaderView.refreshSiteTitle() - - guard let parent = self?.parent as? MySiteViewController else { - return - } - - parent.updateNavigationTitle(for: blog) - + NotificationCenter.default.post(name: NSNotification.Name.WPBlogUpdated, object: nil) }, failure: { [weak self] error in self?.blog.settings?.name = existingBlogTitle self?.blogDetailHeaderView.setTitleLoading(false) @@ -219,6 +221,16 @@ extension SitePickerViewController { }) } + /// Updates site title and navigation bar title + private func updateTitles() { + blogDetailHeaderView.refreshSiteTitle() + + guard let parent = parent as? MySiteViewController else { + return + } + parent.updateNavigationTitle(for: blog) + } + private func showViewSite() { WPAppAnalytics.track(.openedViewSite, withProperties: [WPAppAnalyticsKeyTapSource: "link"], with: blog) From 08489279231720bf7e794eb581e4f7e684f10072 Mon Sep 17 00:00:00 2001 From: Giorgio Ruscigno Date: Mon, 9 May 2022 15:52:21 -0500 Subject: [PATCH 2/2] Update release notes with changes in 18543 --- RELEASE-NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index d80798ef0115..27ec92e21300 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,6 +1,6 @@ 19.9 ----- - +[*] Site Settings: we fixed an issue that prevented the site title to be updated when it changed in Site Settings [#18543] 19.8 -----