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 data properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
iccub committed Jun 9, 2022
1 parent 6290183 commit a229256
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,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 a229256

Please sign in to comment.