Skip to content

Commit 70ce8eb

Browse files
committed
Add lastJetpackBenefitsBannerDismissedTime to GeneralAppSettings.
1 parent 9a26640 commit 70ce8eb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Storage/Storage/Model/Copiable/Models+Copiable.generated.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ extension GeneralAppSettings {
1212
isSimplePaymentsSwitchEnabled: CopiableProp<Bool> = .copy,
1313
isOrderCreationSwitchEnabled: CopiableProp<Bool> = .copy,
1414
knownCardReaders: CopiableProp<[String]> = .copy,
15-
lastEligibilityErrorInfo: NullableCopiableProp<EligibilityErrorInfo> = .copy
15+
lastEligibilityErrorInfo: NullableCopiableProp<EligibilityErrorInfo> = .copy,
16+
lastJetpackBenefitsBannerDismissedTime: NullableCopiableProp<Date> = .copy
1617
) -> GeneralAppSettings {
1718
let installationDate = installationDate ?? self.installationDate
1819
let feedbacks = feedbacks ?? self.feedbacks
@@ -21,6 +22,7 @@ extension GeneralAppSettings {
2122
let isOrderCreationSwitchEnabled = isOrderCreationSwitchEnabled ?? self.isOrderCreationSwitchEnabled
2223
let knownCardReaders = knownCardReaders ?? self.knownCardReaders
2324
let lastEligibilityErrorInfo = lastEligibilityErrorInfo ?? self.lastEligibilityErrorInfo
25+
let lastJetpackBenefitsBannerDismissedTime = lastJetpackBenefitsBannerDismissedTime ?? self.lastJetpackBenefitsBannerDismissedTime
2426

2527
return GeneralAppSettings(
2628
installationDate: installationDate,
@@ -29,7 +31,8 @@ extension GeneralAppSettings {
2931
isSimplePaymentsSwitchEnabled: isSimplePaymentsSwitchEnabled,
3032
isOrderCreationSwitchEnabled: isOrderCreationSwitchEnabled,
3133
knownCardReaders: knownCardReaders,
32-
lastEligibilityErrorInfo: lastEligibilityErrorInfo
34+
lastEligibilityErrorInfo: lastEligibilityErrorInfo,
35+
lastJetpackBenefitsBannerDismissedTime: lastJetpackBenefitsBannerDismissedTime
3336
)
3437
}
3538
}

Storage/Storage/Model/GeneralAppSettings.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,25 @@ public struct GeneralAppSettings: Codable, Equatable, GeneratedCopiable {
4141
///
4242
public let lastEligibilityErrorInfo: EligibilityErrorInfo?
4343

44+
/// The last time the Jetpack benefits banner is dismissed.
45+
public let lastJetpackBenefitsBannerDismissedTime: Date?
46+
4447
public init(installationDate: Date?,
4548
feedbacks: [FeedbackType: FeedbackSettings],
4649
isViewAddOnsSwitchEnabled: Bool,
4750
isSimplePaymentsSwitchEnabled: Bool,
4851
isOrderCreationSwitchEnabled: Bool,
4952
knownCardReaders: [String],
50-
lastEligibilityErrorInfo: EligibilityErrorInfo? = nil) {
53+
lastEligibilityErrorInfo: EligibilityErrorInfo? = nil,
54+
lastJetpackBenefitsBannerDismissedTime: Date? = nil) {
5155
self.installationDate = installationDate
5256
self.feedbacks = feedbacks
5357
self.isViewAddOnsSwitchEnabled = isViewAddOnsSwitchEnabled
5458
self.isSimplePaymentsSwitchEnabled = isSimplePaymentsSwitchEnabled
5559
self.isOrderCreationSwitchEnabled = isOrderCreationSwitchEnabled
5660
self.knownCardReaders = knownCardReaders
5761
self.lastEligibilityErrorInfo = lastEligibilityErrorInfo
62+
self.lastJetpackBenefitsBannerDismissedTime = lastJetpackBenefitsBannerDismissedTime
5863
}
5964

6065
/// Returns the status of a given feedback type. If the feedback is not stored in the feedback array. it is assumed that it has a pending status.
@@ -100,6 +105,7 @@ extension GeneralAppSettings {
100105
self.isOrderCreationSwitchEnabled = try container.decodeIfPresent(Bool.self, forKey: .isOrderCreationSwitchEnabled) ?? false
101106
self.knownCardReaders = try container.decodeIfPresent([String].self, forKey: .knownCardReaders) ?? []
102107
self.lastEligibilityErrorInfo = try container.decodeIfPresent(EligibilityErrorInfo.self, forKey: .lastEligibilityErrorInfo)
108+
self.lastJetpackBenefitsBannerDismissedTime = try container.decodeIfPresent(Date.self, forKey: .lastJetpackBenefitsBannerDismissedTime)
103109

104110
// Decode new properties with `decodeIfPresent` and provide a default value if necessary.
105111
}

0 commit comments

Comments
 (0)