@@ -85,6 +85,16 @@ final class CouponListViewController: UIViewController {
8585 }
8686 . store ( in: & subscriptions)
8787
88+ viewModel. $couponViewModels
89+ . map { viewModels -> Bool in
90+ viewModels. isNotEmpty
91+ }
92+ . removeDuplicates ( )
93+ . sink { [ weak self] hasData in
94+ self ? . configureNavigationBarItems ( hasCoupons: hasData)
95+ }
96+ . store ( in: & subscriptions)
97+
8898 // Call this after the state subscription for extra safety
8999 viewModel. viewDidLoad ( )
90100 }
@@ -148,7 +158,10 @@ extension CouponListViewController: UITableViewDelegate {
148158private extension CouponListViewController {
149159 func configureNavigation( ) {
150160 title = Localization . title
151- navigationItem. rightBarButtonItem = searchBarButtonItem
161+ }
162+
163+ func configureNavigationBarItems( hasCoupons: Bool ) {
164+ navigationItem. rightBarButtonItems = hasCoupons ? [ searchBarButtonItem] : [ ]
152165 }
153166
154167 func configureTableView( ) {
@@ -208,11 +221,10 @@ extension CouponListViewController {
208221 ///
209222 func displayNoResultsOverlay( ) {
210223 let emptyStateViewController = EmptyStateViewController ( style: . list)
211- let config = EmptyStateViewController . Config. withButton (
224+ let config = EmptyStateViewController . Config. simple (
212225 message: . init( string: Localization . emptyStateMessage) ,
213- image: . emptyCouponsImage,
214- details: Localization . emptyStateDetails,
215- buttonTitle: Localization . addCouponButton) { _ in }
226+ image: . emptyCouponsImage
227+ )
216228
217229 displayEmptyStateViewController ( emptyStateViewController)
218230 emptyStateViewController. configure ( config)
@@ -284,15 +296,9 @@ private extension CouponListViewController {
284296 comment: " Coupon management coupon list screen title " )
285297
286298 static let emptyStateMessage = NSLocalizedString (
287- " Everyone loves a deal " ,
299+ " No coupons found " ,
288300 comment: " The title on the placeholder overlay when there are no coupons on the coupon list screen. " )
289301
290- static let emptyStateDetails = NSLocalizedString (
291- " Boost your business by sending customers special offers and discounts. " ,
292- comment: " The description on the placeholder overlay when there are no coupons on the coupon list screen. " )
293-
294- static let addCouponButton = NSLocalizedString ( " Add Coupon " , comment: " Title for the action button to add coupon on the coupon list screen. " )
295-
296302 static let accessibilityLabelSearchCoupons = NSLocalizedString ( " Search coupons " , comment: " Accessibility label for the Search Coupons button " )
297303 static let accessibilityHintSearchCoupons = NSLocalizedString (
298304 " Retrieves a list of coupons that contain a given keyword. " ,
0 commit comments