diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 434c16ed212e..6981e3c136e3 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,5 +1,6 @@ 25.9 ----- +* [*] Site Switcher screen now properly dismisses after successfully adding a self-hosted site. [#24273] * [*] Updated site display logic in sidebar to prioritize showing the currently selected site on iPad. [#24277] diff --git a/WordPress/Classes/ViewRelated/Blog/Site Picker/SiteSwitcherView.swift b/WordPress/Classes/ViewRelated/Blog/Site Picker/SiteSwitcherView.swift index d26c243b3193..2e29696f0963 100644 --- a/WordPress/Classes/ViewRelated/Blog/Site Picker/SiteSwitcherView.swift +++ b/WordPress/Classes/ViewRelated/Blog/Site Picker/SiteSwitcherView.swift @@ -4,6 +4,7 @@ import WordPressUI final class SiteSwitcherViewController: UIHostingController, UIPopoverPresentationControllerDelegate { private let viewModel: BlogListViewModel + private var signinObserver: NSObjectProtocol? init(configuration: BlogListConfiguration = .defaultConfig, addSiteAction: @escaping ((AddSiteMenuViewModel.Selection) -> Void), @@ -28,6 +29,14 @@ final class SiteSwitcherViewController: UIHostingController, U if #available(iOS 17, *) { AppTips.SitePickerTip().invalidate(reason: .actionPerformed) } + + // Add observer for sign-in completion notification + let notificationName = NSNotification.Name(WordPressAuthenticationManager.WPSigninDidFinishNotification) + signinObserver = NotificationCenter.default.addObserver(forName: notificationName, object: nil, queue: nil) { [weak self] _ in + DispatchQueue.main.async { + self?.presentingViewController?.dismiss(animated: true) + } + } } @objc private func buttonCloseTapped() {