@@ -170,6 +170,32 @@ class CommentDetailViewController: UIViewController {
170170 }
171171 }
172172
173+ // MARK: Nav Bar Buttons
174+
175+ private lazy var editBarButtonItem : UIBarButtonItem = {
176+ let button = UIBarButtonItem ( barButtonSystemItem: . edit,
177+ target: self ,
178+ action: #selector( editButtonTapped) )
179+ button. accessibilityLabel = NSLocalizedString ( " Edit comment " , comment: " Accessibility label for button to edit a comment from a notification " )
180+ return button
181+ } ( )
182+
183+ private lazy var nextButton : UIButton = {
184+ let button = UIButton ( type: . custom)
185+ button. setImage ( . gridicon( . arrowUp) , for: . normal)
186+ button. addTarget ( self , action: #selector( nextButtonTapped) , for: . touchUpInside)
187+ button. accessibilityLabel = NSLocalizedString ( " Previous notification " , comment: " Accessibility label for the previous notification button " )
188+ return button
189+ } ( )
190+
191+ private lazy var previousButton : UIButton = {
192+ let button = UIButton ( type: . custom)
193+ button. setImage ( . gridicon( . arrowDown) , for: . normal)
194+ button. addTarget ( self , action: #selector( previousButtonTapped) , for: . touchUpInside)
195+ button. accessibilityLabel = NSLocalizedString ( " Next notification " , comment: " Accessibility label for the next notification button " )
196+ return button
197+ } ( )
198+
173199 // MARK: Initialization
174200
175201 @objc init ( comment: Comment ,
@@ -204,7 +230,6 @@ class CommentDetailViewController: UIViewController {
204230 configureReplyView ( )
205231 setupKeyboardManager ( )
206232 configureSuggestionsView ( )
207- configureNavigationBar ( )
208233 configureTable ( )
209234 configureRows ( )
210235 refreshCommentReplyIfNeeded ( )
@@ -220,6 +245,11 @@ class CommentDetailViewController: UIViewController {
220245 keyboardManager? . stopListeningToKeyboardNotifications ( )
221246 }
222247
248+ override func viewDidLayoutSubviews( ) {
249+ super. viewDidLayoutSubviews ( )
250+ configureNavigationBar ( )
251+ }
252+
223253 override func viewWillTransition( to size: CGSize , with coordinator: UIViewControllerTransitionCoordinator ) {
224254 super. viewWillTransition ( to: size, with: coordinator)
225255
@@ -259,6 +289,8 @@ private extension CommentDetailViewController {
259289 static let deleteButtonInsets = UIEdgeInsets ( top: 4 , left: 20 , bottom: 4 , right: 20 )
260290 static let deleteButtonNormalColor = UIColor ( light: . error, dark: . muriel( name: . red, . shade40) )
261291 static let deleteButtonHighlightColor : UIColor = . white
292+ static let arrowButtonSize : CGFloat = 24
293+ static let arrowButtonSpacing : CGFloat = 12
262294 }
263295
264296 /// Convenience computed variable for an inset setting that hides a cell's separator by pushing it off the edge of the screen.
@@ -301,7 +333,7 @@ private extension CommentDetailViewController {
301333 navigationController? . navigationBar. isTranslucent = true
302334 title = viewTitle
303335
304- configureEditButtonItem ( )
336+ configureNavBarButtons ( )
305337 }
306338
307339 /// Updates the navigation bar style based on the `isBlurred` boolean parameter. The intent is to show a visual blur effect when the content is scrolled,
@@ -311,10 +343,30 @@ private extension CommentDetailViewController {
311343 navigationItem. standardAppearance = isBlurred ? blurredBarAppearance : opaqueBarAppearance
312344 }
313345
314- func configureEditButtonItem( ) {
315- navigationItem. rightBarButtonItem = comment. allowsModeration ( ) ? UIBarButtonItem ( barButtonSystemItem: . edit,
316- target: self ,
317- action: #selector( editButtonTapped) ) : nil
346+ func configureNavBarButtons( ) {
347+ var barButtonItems : [ UIBarButtonItem ] = [ ]
348+
349+ if isNotificationComment && splitViewControllerIsHorizontallyCompact {
350+ barButtonItems. append ( makeNavigationButtons ( ) )
351+ }
352+
353+ if comment. allowsModeration ( ) {
354+ barButtonItems. append ( editBarButtonItem)
355+ }
356+
357+ navigationItem. setRightBarButtonItems ( barButtonItems, animated: false )
358+ }
359+
360+ func makeNavigationButtons( ) -> UIBarButtonItem {
361+ // Create custom view to match that in NotificationDetailsViewController.
362+ let buttonStackView = UIStackView ( arrangedSubviews: [ nextButton, previousButton] )
363+ buttonStackView. axis = . horizontal
364+ buttonStackView. spacing = Constants . arrowButtonSpacing
365+
366+ let width = ( Constants . arrowButtonSize * 2 ) + Constants. arrowButtonSpacing
367+ buttonStackView. frame = CGRect ( x: 0 , y: 0 , width: width, height: Constants . arrowButtonSize)
368+
369+ return UIBarButtonItem ( customView: buttonStackView)
318370 }
319371
320372 func configureTable( ) {
@@ -372,7 +424,7 @@ private extension CommentDetailViewController {
372424 /// Performs a complete refresh on the table and the row configuration, since some rows may be hidden due to changes to the Comment object.
373425 /// Use this method instead of directly calling the `reloadData` on the table view property.
374426 func refreshData( ) {
375- configureEditButtonItem ( )
427+ configureNavBarButtons ( )
376428 configureRows ( )
377429 tableView. reloadData ( )
378430 }
@@ -556,6 +608,16 @@ private extension CommentDetailViewController {
556608 present ( navigationControllerToPresent, animated: true )
557609 }
558610
611+ @objc func previousButtonTapped( ) {
612+ // TODO: handle notification change
613+ DDLogInfo ( " previousButtonTapped " )
614+ }
615+
616+ @objc func nextButtonTapped( ) {
617+ // TODO: handle notification change
618+ DDLogInfo ( " nextButtonTapped " )
619+ }
620+
559621 func deleteButtonTapped( ) {
560622 deleteComment ( ) { [ weak self] success in
561623 if success {
0 commit comments