Skip to content

Commit cf2a4b8

Browse files
authored
Correctly display FAB in post screen on iPad split screen mode (#18609)
2 parents f04d4a4 + 47d0ea7 commit cf2a4b8

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* [*] Block Editor: Gallery block: Fix broken "Link To" settings and add "Image Size" settings [https://github.com/wordpress-mobile/gutenberg-mobile/pull/4841]
1414
* [*] Block Editor: Unsupported Block Editor: Prevent WordPress.com tour banner from displaying. [https://github.com/wordpress-mobile/gutenberg-mobile/pull/4820]
1515
* [*] Widgets: we fixed an issue where text appeared flipped in rtl languages [#18567]
16+
* [*] Posts list: we fixed an issue where the create button was not shown on iPad in split screen [#18609]
1617

1718
19.8
1819
-----

WordPress/Classes/ViewRelated/Post/PostListViewController.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
174174
configureNavigationButtons()
175175

176176
configureInitialFilterIfNeeded()
177+
listenForAppComingToForeground()
177178

178179
createButtonCoordinator.add(to: view, trailingAnchor: view.safeAreaLayoutGuide.trailingAnchor, bottomAnchor: view.safeAreaLayoutGuide.bottomAnchor)
179180
}
@@ -212,6 +213,12 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
212213

213214
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
214215
super.traitCollectionDidChange(previousTraitCollection)
216+
toggleCreateButton()
217+
}
218+
219+
/// Shows/hides the create button based on the trait collection horizontal size class
220+
@objc
221+
private func toggleCreateButton() {
215222
if traitCollection.horizontalSizeClass == .compact {
216223
createButtonCoordinator.showCreateButton(for: blog)
217224
} else {
@@ -379,6 +386,13 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
379386
filterSettings.setFilterWithPostStatus(initialFilterWithPostStatus)
380387
}
381388

389+
/// Listens for the app coming to foreground in order to properly set the create button
390+
private func listenForAppComingToForeground() {
391+
NotificationCenter.default.addObserver(self,
392+
selector: #selector(toggleCreateButton),
393+
name: UIApplication.willEnterForegroundNotification,
394+
object: nil)
395+
}
382396
// Mark - Layout Methods
383397

384398
override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {

0 commit comments

Comments
 (0)