Skip to content

Commit b01ebd9

Browse files
committed
small logic fixes
1 parent 2520421 commit b01ebd9

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

TCAT/Controllers/HomeViewController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ class HomeViewController: UIViewController {
239239

240240
func showWhatsNewCardIfNeeded() {
241241

242+
if VersionStore.shared.isNewCardAvailable() {
243+
userDefaults.set(false, forKey: Constants.UserDefaults.whatsNewDismissed)
244+
}
245+
242246
let promotionCardDismissed = userDefaults.bool(forKey: Constants.UserDefaults.promotionDismissed)
243247
let whatsNewDismissed = userDefaults.bool(forKey: Constants.UserDefaults.whatsNewDismissed)
244248

TCAT/Supporting Files/Constants.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ struct Constants {
239239
static let onboardingShown = "onboardingShown"
240240
static let showLocationAuthReminder = "locationAuthReminder"
241241
static let uid = "uid"
242+
243+
/// True if the current card has been dismissed by user
242244
static let whatsNewDismissed = "whatsNewDismissed"
243245
static let recentSearch = "recentSearch"
244246
static let allBusStops = "allBusStops"

TCAT/Utilities/VersionStore.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class VersionStore: WhatsNewVersionStore {
3939
}
4040

4141
func storeShownCard(card: WhatsNewCard) {
42+
guard !card.isEqual(to: WhatsNewCard.promotion) else { return }
4243
if let encodedData = try? JSONEncoder().encode(card) {
4344
userDefaults.set(encodedData, forKey: Constants.UserDefaults.whatsNewCardVersion)
4445
} else {

0 commit comments

Comments
 (0)