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

Fix #5479: Set consolidation date properly. #5480

Merged
merged 1 commit into from Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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