Skip to content

Commit

Permalink
Make usesUnifiedFeedbackForm dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
quanganhdo committed Aug 27, 2024
1 parent e58b1e5 commit 13bf47c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2540,8 +2540,8 @@
B6CB93E4286445AB0090FEB4 /* Base64DownloadSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base64DownloadSession.swift; sourceTree = "<group>"; };
B6DFE6CF2BC7E47500A9CE59 /* SwiftLintTool.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftLintTool.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
B6DFE6D92BC7E61B00A9CE59 /* SwiftLintToolBundleConfiguration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SwiftLintToolBundleConfiguration.xcconfig; sourceTree = "<group>"; };
BD10B8A92C7629740033115D /* Logger+Subscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Logger+Subscription.swift"; sourceTree = "<group>"; };
BBFF18B02C76448100C48D7D /* QuerySubmittedTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuerySubmittedTests.swift; sourceTree = "<group>"; };
BD10B8A92C7629740033115D /* Logger+Subscription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Logger+Subscription.swift"; sourceTree = "<group>"; };
BD15DB842B959CFD00821457 /* BundleExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BundleExtension.swift; sourceTree = "<group>"; };
BD2F39EA2C19F955005B19E7 /* NetworkProtectionDNSSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProtectionDNSSettingsView.swift; sourceTree = "<group>"; };
BD862E022B30DA170073E2EE /* VPNFeedbackFormViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNFeedbackFormViewModel.swift; sourceTree = "<group>"; };
Expand Down
7 changes: 5 additions & 2 deletions DuckDuckGo/SettingsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ final class SettingsViewModel: ObservableObject {
private var legacyViewProvider: SettingsLegacyViewProvider
private lazy var versionProvider: AppVersion = AppVersion.shared
private let voiceSearchHelper: VoiceSearchHelperProtocol
private let subscriptionFeatureAvailability: SubscriptionFeatureAvailability
private let syncPausedStateManager: any SyncPausedStateManaging
var emailManager: EmailManager { EmailManager() }
private let historyManager: HistoryManaging
Expand Down Expand Up @@ -338,7 +339,9 @@ final class SettingsViewModel: ObservableObject {
legacyViewProvider.syncService.authState != .inactive ? .on : .off
}

let usesUnifiedFeedbackForm: Bool
var usesUnifiedFeedbackForm: Bool {
subscriptionManager.accountManager.isUserAuthenticated && subscriptionFeatureAvailability.usesUnifiedFeedbackForm
}

// MARK: Default Init
init(state: SettingsState? = nil,
Expand All @@ -355,12 +358,12 @@ final class SettingsViewModel: ObservableObject {
self.state = SettingsState.defaults
self.legacyViewProvider = legacyViewProvider
self.subscriptionManager = subscriptionManager
self.subscriptionFeatureAvailability = subscriptionFeatureAvailability
self.voiceSearchHelper = voiceSearchHelper
self.deepLinkTarget = deepLink
self.historyManager = historyManager
self.syncPausedStateManager = syncPausedStateManager
self.privacyProDataReporter = privacyProDataReporter
self.usesUnifiedFeedbackForm = subscriptionManager.accountManager.isUserAuthenticated && subscriptionFeatureAvailability.usesUnifiedFeedbackForm

setupNotificationObservers()
updateRecentlyVisitedSitesVisibility()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@

import Foundation

struct DefaultFeedbackMetadata: UnifiedFeedbackMetadata {

}
struct DefaultFeedbackMetadata: UnifiedFeedbackMetadata {}

/// Default implementation for Privacy Pro metadata collector
/// Intentionally left blank as we currently don't collect any metadata for PIR and ITR
/// See `DefaultVPNMetadataCollector` for a reference implementation
final class DefaultMetadataCollector: UnifiedMetadataCollector {
func collectMetadata() async -> DefaultFeedbackMetadata? {
nil
Expand Down

0 comments on commit 13bf47c

Please sign in to comment.