Skip to content

Commit

Permalink
Receive privacy config updates in AddressBarModel on main thread (#3574)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1201037661562251/1208804405760977/f

Description:
This privacy config update may update a published value so must be received on main thread.
  • Loading branch information
ayoy authored Nov 20, 2024
1 parent 5af50c9 commit e83fd00
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions DuckDuckGo/HomePage/Model/HomePageAddressBarModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ extension HomePage.Models {
isExperimentActive = privacyConfigurationManager.privacyConfig.isEnabled(featureKey: .newTabSearchField)
setUpExperimentIfNeeded()

privacyConfigCancellable = privacyConfigurationManager.updatesPublisher.sink { [weak self, weak privacyConfigurationManager] in
self?.isExperimentActive = privacyConfigurationManager?.privacyConfig.isEnabled(featureKey: .newTabSearchField) == true
}
privacyConfigCancellable = privacyConfigurationManager.updatesPublisher
.receive(on: DispatchQueue.main)
.sink { [weak self, weak privacyConfigurationManager] in
self?.isExperimentActive = privacyConfigurationManager?.privacyConfig.isEnabled(featureKey: .newTabSearchField) == true
}
}

private lazy var addressBarViewController: AddressBarViewController? = createAddressBarViewController()
Expand Down

0 comments on commit e83fd00

Please sign in to comment.