Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #5479: Set consolidation date properly. (#5480)
Browse files Browse the repository at this point in the history
  • Loading branch information
iccub committed Jun 9, 2022
1 parent 40f4cd3 commit d17ce02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -65,7 +65,11 @@ public struct PrivacyReportsManager {
}

public static func consolidateData(dayRange range: Int = 30) {
if Date() < Preferences.PrivacyReports.nextConsolidationDate.value {
if Preferences.PrivacyReports.nextConsolidationDate.value == nil {
Preferences.PrivacyReports.nextConsolidationDate.value = Date().advanced(by: 7.days)
}

if let consolidationDate = Preferences.PrivacyReports.nextConsolidationDate.value, Date() < consolidationDate {
return
}

Expand Down
2 changes: 1 addition & 1 deletion Client/Frontend/ClientPreferences.swift
Expand Up @@ -309,7 +309,7 @@ extension Preferences {
static let captureVPNAlerts = Option<Bool>(key: "privacy-hub.capture-vpn-alerts", default: true)
/// Tracker when to consolidate tracker and vpn data. By default the first consolidation happens 7 days after Privacy Reports build is installed.
static let nextConsolidationDate =
Option<Date>(key: "privacy-hub.next-consolidation-date", default: Date().advanced(by: 7.days))
Option<Date?>(key: "privacy-hub.next-consolidation-date", default: nil)
/// Determines whether to show a Privacy Reports onboarding popup on the NTP.
public static let ntpOnboardingCompleted =
Option<Bool>(key: "privacy-hub.onboarding-completed", default: true)
Expand Down

0 comments on commit d17ce02

Please sign in to comment.