Skip to content

Commit

Permalink
Handle ignores sync for new checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Jan 18, 2024
1 parent d79ba40 commit e046f25
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Pareto/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension Defaults.Keys {
static let sendHWInfo = Key<Bool>("sendHWInfo", default: false, suite: extensionDefaults)
static let lastHWAsk = Key<Int>("lastHWAsk", default: 0, suite: extensionDefaults)
static let appliedIgnoredChecks = Key<Bool>("appliedIgnoredChecksv1", default: false, suite: extensionDefaults)

static let appliedIgnoredChecksIDs = Key<Array<String>>("appliedIgnoredChecksv4", default: [], suite: extensionDefaults)
// License
static let license = Key<String>("license", default: "", suite: extensionDefaults)
static let reportingRole = Key<ReportingRoles>("reportingRole", default: .free, suite: extensionDefaults)
Expand Down
2 changes: 1 addition & 1 deletion Pareto/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>5422</string>
<string>5429</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
19 changes: 11 additions & 8 deletions Pareto/Teams.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,23 @@ class TeamSettingsUpdater: ObservableObject {
}

func updateIgnored() {
if Defaults[.appliedIgnoredChecks] {
os_log("Team ignored checks already applied once.")
return
}

for claim in Claims.global.all {
for check in claim.checks {
if ignoredChecks.contains(where: { $0 == check.UUID }) {
check.isActive = false
if !Defaults[.appliedIgnoredChecksIDs].contains(check.UUID) {
// old version of sync
if Defaults[.appliedIgnoredChecks] {
NoUnusedUsers.sharedInstance.isActive = false
NoAdminUser.sharedInstance.isActive = false
}else {
check.isActive = false
}
Defaults[.appliedIgnoredChecksIDs].append(check.UUID)
}

}
}
}

os_log("Team ignored checks applied.")
Defaults[.appliedIgnoredChecks] = true
}
}

0 comments on commit e046f25

Please sign in to comment.