Skip to content

Commit 4b87e1a

Browse files
authored
[Hotfix] Remove banner when the view will appear if necessary (#3511)
2 parents aa36bcf + aeb1c3d commit 4b87e1a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

podcasts/PodcastListViewController.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ class PodcastListViewController: PCViewController, UIGestureRecognizerDelegate,
161161
}
162162

163163
private func loadBannerAd() {
164+
bannerTask?.cancel()
165+
164166
if FeatureFlag.bannerAdPodcasts.enabled && !SubscriptionHelper.hasActiveSubscription() {
165-
bannerTask?.cancel()
166167
DiscoverServerHandler.shared.blazePromotion(for: .podcastList) { [weak self] promotion, shouldAnimate in
167168
guard let self = self else { return }
168169

@@ -177,6 +178,17 @@ class PodcastListViewController: PCViewController, UIGestureRecognizerDelegate,
177178
self.setupBannerAd(promotion: promotion, shouldAnimate: false)
178179
}
179180
}
181+
} else {
182+
if bannerAdModel != nil {
183+
bannerAdModel = nil
184+
UIView.animate(withDuration: 0.25, delay: 0, options: [.curveEaseOut]) {
185+
self.isAnimatingBannerAd = false
186+
} completion: { _ in
187+
self.podcastsCollectionView.performBatchUpdates({
188+
self.podcastsCollectionView.collectionViewLayout.invalidateLayout()
189+
})
190+
}
191+
}
180192
}
181193
}
182194

0 commit comments

Comments
 (0)