Commit 73d0a9c11c

73d0a9c11cc9547285d5034567360f75a52b0471

parent: 0cb5ee74c7

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-24 05:51 UTC

Delete the entitlement shims

PremiumAccessService forwarded to FeatureAccessService and had one live caller;
its hasAccess(to:) and the whole PremiumCapability enum were dead.
DataAccessService was pure forwarding over a parallel DataCapability enum that
P1 had already reduced to a single case.

loadLookup's parameter was DataCapability?, so its gate had to translate through
capability.feature to reach a real capability. It takes FeatureCapability? now
and asks hasAccess(to:) directly; loadExtendedSubdomains' call site is unchanged
because both enums used the same case name.

This also removes the last entitlement decision living outside
FeatureAccessService: PremiumAccessService used currentTier != .free as a stand
in for unlimitedTrackedDomains, which !12 flagged and which leaves with the file.

Layout: unified · split

DomainDig/ContentView.swift +1 −1
@@ -468,7 +468,7 @@ struct ContentView: View {
468468 error: viewModel.subdomainsError,
469469 provenance: viewModel.currentSnapshot.provenanceBySection[.subdomains],
470470 confidence: viewModel.currentSnapshot.subdomainConfidence,
471 showsExtendedPlaceholder: !DataAccessService.hasAccess(to: .extendedSubdomains),
471 showsExtendedPlaceholder: !FeatureAccessService.hasAccess(to: .extendedSubdomains),
472472 extendedCount: viewModel.extendedSubdomains.count,
473473 extendedLoading: viewModel.extendedSubdomainsLoading,
474474 extendedError: viewModel.extendedSubdomainsError,
DomainDig/DataAccessService.swift deleted −16
@@ -1,16 +0,0 @@
1import Foundation
2
3enum DataAccessService {
4 static func hasAccess(to capability: DataCapability) -> Bool {
5 FeatureAccessService.hasAccess(to: capability.feature)
6 }
7}
8
9extension DataCapability {
10 /// The plan feature that unlocks this data.
11 var feature: FeatureCapability {
12 switch self {
13 case .extendedSubdomains: .extendedSubdomains
14 }
15 }
16}
DomainDig/DomainViewModel.swift +5 −5
@@ -803,7 +803,7 @@ final class DomainViewModel {
803803 return true
804804 }
805805
806 guard PremiumAccessService.canAddTrackedDomain(currentCount: trackedDomains.count) else {
806 guard FeatureAccessService.canAddTrackedDomain(currentCount: trackedDomains.count) else {
807807 upgradePrompt = FeatureAccessService.upgradePromptForTrackedDomains(currentCount: trackedDomains.count)
808808 return false
809809 }
@@ -1320,7 +1320,7 @@ final class DomainViewModel {
13201320 /// already. With a `capability`, shows the upgrade prompt when the plan
13211321 /// doesn't include it; without one the lookup is open to every tier.
13221322 private func loadLookup<Item>(
1323 _ capability: DataCapability? = nil,
1323 _ capability: FeatureCapability? = nil,
13241324 into items: ReferenceWritableKeyPath<DomainViewModel, [Item]>,
13251325 loading: ReferenceWritableKeyPath<DomainViewModel, Bool>,
13261326 error: ReferenceWritableKeyPath<DomainViewModel, String?>,
@@ -1328,8 +1328,8 @@ final class DomainViewModel {
13281328 fetch: () async -> ServiceResult<[Item]>
13291329 ) async {
13301330 guard !searchedDomain.isEmpty else { return }
1331 if let capability, !DataAccessService.hasAccess(to: capability) {
1332 upgradePrompt = FeatureAccessService.upgradePrompt(for: capability.feature)
1331 if let capability, !FeatureAccessService.hasAccess(to: capability) {
1332 upgradePrompt = FeatureAccessService.upgradePrompt(for: capability)
13331333 return
13341334 }
13351335 guard self[keyPath: items].isEmpty else { return }
@@ -3576,7 +3576,7 @@ final class DomainViewModel {
35763576 lines.append(" \(subdomain.hostname)\(marker)")
35773577 }
35783578 }
3579 if !DataAccessService.hasAccess(to: .extendedSubdomains) {
3579 if !FeatureAccessService.hasAccess(to: .extendedSubdomains) {
35803580 lines.append(" Extended subdomain discovery (Pro)")
35813581 }
35823582 return lines
DomainDig/HistoryView.swift +1 −1
@@ -229,7 +229,7 @@ struct HistoryDetailView: View {
229229 error: snapshot.subdomainsError,
230230 provenance: snapshot.provenanceBySection[.subdomains],
231231 confidence: snapshot.subdomainConfidence,
232 showsExtendedPlaceholder: !DataAccessService.hasAccess(to: .extendedSubdomains)
232 showsExtendedPlaceholder: !FeatureAccessService.hasAccess(to: .extendedSubdomains)
233233 )
234234 .padding(.top, appDensity.metrics.sectionSpacing)
235235 if let comparisonSnapshot = viewModel.comparisonSnapshot(for: entry) {
DomainDig/Models.swift −12
@@ -395,10 +395,6 @@ struct WorkflowRunSummary: Identifiable, Equatable {
395395/// Data that a tier gates. Ownership and DNS history derive from the user's own
396396/// stored snapshots and are not gated at all; pricing and reputation were
397397/// removed, having no local derivation and no configured provider.
398enum DataCapability: String, Codable {
399 case extendedSubdomains
400}
401
402398struct DomainOwnershipHistoryEvent: Identifiable, Codable, Equatable, Sendable {
403399 let id: UUID
404400 let date: Date
@@ -978,14 +974,6 @@ extension DomainHealth {
978974 }
979975}
980976
981enum PremiumCapability: String, Codable {
982 case unlimitedTrackedDomains
983 case automatedMonitoring
984 case pushAlerts
985 case batchTracking
986 case advancedExports
987}
988
989977enum CollaborationPermission: String, Codable, Equatable {
990978 case readOnly
991979 case editable
DomainDig/PremiumAccessService.swift deleted −26
@@ -1,26 +0,0 @@
1import Foundation
2
3enum PremiumAccessService {
4 static func hasAccess(to capability: PremiumCapability) -> Bool {
5 switch capability {
6 case .advancedExports:
7 return FeatureAccessService.hasAccess(to: .advancedExports)
8 case .batchTracking:
9 return FeatureAccessService.hasAccess(to: .batchOperations)
10 case .unlimitedTrackedDomains:
11 return FeatureAccessService.currentTier != .free
12 case .automatedMonitoring:
13 return FeatureAccessService.hasAccess(to: .automatedMonitoring)
14 case .pushAlerts:
15 return FeatureAccessService.hasAccess(to: .localAlerts)
16 }
17 }
18
19 static func trackedDomainLimitMessage(currentCount: Int) -> String? {
20 FeatureAccessService.trackedDomainLimitMessage(currentCount: currentCount)
21 }
22
23 static func canAddTrackedDomain(currentCount: Int) -> Bool {
24 FeatureAccessService.canAddTrackedDomain(currentCount: currentCount)
25 }
26}