Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 344c398

Browse files
Natalia Haratehjdisho
Natalia Harateh
authored andcommitted
Fix extra space at the bottom of pull request status view (#2229) (#2761)
* notify delegate when manageButton's visibility changes * calculate inset for manageButton dynamically * compute threadInset using insetForManageButton * update safe inset when manageButton's visibility changes
1 parent 0354281 commit 344c398

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

Classes/Issues/IssueManagingContextController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import GitHubAPI
1212

1313
protocol IssueManagingContextControllerDelegate: class {
1414
func willMutateModel(from controller: IssueManagingContextController)
15+
func didUpdateManageButtonVisibility(_ manageButton: UIView)
1516
}
1617

1718
final class IssueManagingContextController: NSObject, ContextMenuDelegate {
@@ -80,6 +81,7 @@ final class IssueManagingContextController: NSObject, ContextMenuDelegate {
8081

8182
func updateButtonVisibility() {
8283
manageButton.isHidden = actions.count == 0
84+
delegate?.didUpdateManageButtonVisibility(manageButton)
8385
}
8486

8587
enum Action {

Classes/Issues/IssuesViewController.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ IssueManagingContextControllerDelegate {
4545
private var bookmarkNavController: BookmarkNavigationController?
4646
private var autocompleteController: AutocompleteController!
4747
private let manageController: IssueManagingContextController
48-
private let threadInset = UIEdgeInsets(
49-
top: Styles.Sizes.rowSpacing / 2,
50-
left: Styles.Sizes.gutter,
51-
bottom: 2 * Styles.Sizes.rowSpacing + Styles.Sizes.tableCellHeight,
52-
right: Styles.Sizes.gutter
53-
)
48+
private var insetForManageButton: CGFloat {
49+
return manageController.manageButton.isHidden ? 0 : manageController.manageButton.frame.height
50+
}
51+
private var threadInset: UIEdgeInsets {
52+
return UIEdgeInsets(
53+
top: Styles.Sizes.rowSpacing / 2,
54+
left: Styles.Sizes.gutter,
55+
bottom: 2 * Styles.Sizes.rowSpacing + insetForManageButton,
56+
right: Styles.Sizes.gutter
57+
)
58+
}
5459

5560
private var needsScrollToBottom = false
5661
private var lastTimelineElement: ListDiffable?
@@ -639,4 +644,8 @@ IssueManagingContextControllerDelegate {
639644
needsScrollToBottom = true
640645
}
641646

647+
func didUpdateManageButtonVisibility(_ manageButton: UIView) {
648+
feed.collectionView.updateSafeInset(container: view, base: threadInset)
649+
}
650+
642651
}

0 commit comments

Comments
 (0)