Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image recommendations - Time-box new feature announcement #4860

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add expiration date early return for Image Recommendation announcement
  • Loading branch information
mfvarani committed May 24, 2024
commit 1f0f3e3596a5d5017c22d7f9fe87adc029f4c338
25 changes: 25 additions & 0 deletions Wikipedia/Code/ExploreViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,13 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo

var addArticlesToReadingListVCDidDisappear: (() -> Void)? = nil

// TODO: - Remove after expiry date (5 Aug, 2024)
private func presentImageRecommendationsFeatureAnnouncementIfNeeded() {

guard ImageRecommendationsFeatureAnnouncementExpiration.isAnnouncementActive() else {
return
}

guard let fetchedResultsController,
let groups = fetchedResultsController.fetchedObjects else {
return
Expand Down Expand Up @@ -919,6 +924,26 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo
}
}

// MARK: - Image Recommendations Announcement expiration
// TODO: - Remove after expiry date (5 Aug, 2024)
struct ImageRecommendationsFeatureAnnouncementExpiration {
static let expiryDate: Date? = {
var expiryDateComponents = DateComponents()
expiryDateComponents.year = 2024
expiryDateComponents.month = 8
expiryDateComponents.day = 5
return Calendar.current.date(from: expiryDateComponents)
}()

static func isAnnouncementActive() -> Bool {
guard let expiryDate else {
return false
}
let currentDate = Date()
return currentDate <= expiryDate
}
}

// MARK: - Analytics
extension ExploreViewController {
private func logArticleSavedStateChange(_ wasArticleSaved: Bool, saveButton: SaveButton?, article: WMFArticle, userInfo: Any?) {
Expand Down