Skip to content

Commit 7452f0e

Browse files
committed
[iOS] Register P3A metric configuration component
1 parent 5652fe9 commit 7452f0e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ios/app/brave_core_main.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "base/threading/thread_restrictions.h"
2626
#include "brave/components/brave_user_agent/browser/brave_user_agent_exceptions.h"
2727
#include "brave/components/p3a/buildflags.h"
28+
#include "brave/components/p3a/component_installer.h"
2829
#include "brave/components/p3a/histograms_braveizer.h"
2930
#include "brave/components/p3a/p3a_config.h"
3031
#include "brave/components/p3a/p3a_service.h"
@@ -309,6 +310,13 @@ - (void)initializeP3AServiceForChannel:(NSString*)channel
309310
_p3a_service->InitCallbacks();
310311
_p3a_service->Init(GetApplicationContext()->GetSharedURLLoaderFactory());
311312
_histogram_braveizer = p3a::HistogramsBraveizer::Create();
313+
// Typically we'd register this component in RegisterComponentsForUpdate, but
314+
// because iOS needs to pass in the install date from the Swift side we don't
315+
// initialize the P3A service until after WebMain is started. If this changes
316+
// in the future, move this call there.
317+
p3a::RegisterP3AComponent(
318+
GetApplicationContext()->GetComponentUpdateService(),
319+
_p3a_service->remote_config_manager()->GetWeakPtr());
312320
#endif // BUILDFLAG(BRAVE_P3A_ENABLED)
313321
}
314322

0 commit comments

Comments
 (0)