Skip to content

Commit

Permalink
Show Reader comments in a modal
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Feb 27, 2025
1 parent 5ebee56 commit 6fcb639
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ - (void)trackReplyTo:(BOOL)replyTarget {

- (void)configureNavbar
{
// Don't show 'Reader' in the next-view back button
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@" " style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
self.navigationItem.backButtonTitle = @"";

self.title = NSLocalizedString(@"Comments", @"Title of the reader's comments screen");
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ final class ReaderCommentAction {
navigateToCommentID: Int? = nil,
source: ReaderCommentsSource
) {
guard let controller = ReaderCommentsViewController(post: post, source: source) else {
guard let commentsVC = ReaderCommentsViewController(post: post, source: source) else {
return
}
controller.navigateToCommentID = navigateToCommentID as NSNumber?
controller.trackCommentsOpened()
controller.hidesBottomBarWhenPushed = true
origin.navigationController?.pushViewController(controller, animated: true)
commentsVC.navigateToCommentID = navigateToCommentID as NSNumber?
commentsVC.trackCommentsOpened()
commentsVC.hidesBottomBarWhenPushed = true

if origin.traitCollection.horizontalSizeClass == .compact {
let navigationVC = UINavigationController(rootViewController: commentsVC)
commentsVC.navigationItem.leftBarButtonItem = UIBarButtonItem(title: SharedStrings.Button.close, primaryAction: UIAction { [weak origin] _ in
origin?.dismiss(animated: true)
})
origin.present(navigationVC, animated: true)
} else {
origin.navigationController?.pushViewController(commentsVC, animated: true)
}
}
}

0 comments on commit 6fcb639

Please sign in to comment.