Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
- Move Search bar telemetry to the trackStartUpTelemetry function
- Move updateCreditCardAutofillStatus into main.async
- Remove commented code
- Move setupNotifications back to setupEssentialUI since we dont want race conditions
  • Loading branch information
lmarceau committed Jan 31, 2025
1 parent 80598e2 commit 40f776b
Showing 1 changed file with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -747,33 +747,19 @@ class BrowserViewController: UIViewController,
setupEssentialUI()
subscribeToRedux()

DispatchQueue.global(qos: .background).asyncAfter(deadline: .now() + 2.0) {
DispatchQueue.global(qos: .background).async {
// App startup telemetry accesses RustLogins to queryLogins, shouldn't be on the app startup critical path
self.trackStartupTelemetry()
}

// Non-UI tasks only
DispatchQueue.global(qos: .background).async {
self.setupNotifications()
SearchBarSettingsViewModel.recordLocationTelemetry(for: self.isBottomSearchBar ? .bottom : .top)

// Feature flag for credit card until we fully enable this feature
let autofillCreditCardStatus = self.featureFlags.isFeatureEnabled(
.creditCardAutofillStatus, checking: .buildOnly)
// We need to update autofill status on sync manager as there could be delay from nimbus
// in getting the value. When the delay happens the credit cards might not sync
// as the default value is false
self.profile.syncManager?.updateCreditCardAutofillStatus(value: autofillCreditCardStatus)
}
}

private func setupEssentialUI() {
addSubviews()
setupConstraints()
setupNotifications()

DispatchQueue.main.async {
self.overlayManager.setURLBar(urlBarView: self.urlBarView)
// self.updateToolbarStateForTraitCollection(self.traitCollection)

// Update theme of already existing views
let theme = self.currentTheme()
Expand Down Expand Up @@ -801,6 +787,14 @@ class BrowserViewController: UIViewController,
// links into the view from other apps.
let dropInteraction = UIDropInteraction(delegate: self)
self.view.addInteraction(dropInteraction)

// Feature flag for credit card until we fully enable this feature
let autofillCreditCardStatus = self.featureFlags.isFeatureEnabled(
.creditCardAutofillStatus, checking: .buildOnly)
// We need to update autofill status on sync manager as there could be delay from nimbus
// in getting the value. When the delay happens the credit cards might not sync
// as the default value is false
self.profile.syncManager?.updateCreditCardAutofillStatus(value: autofillCreditCardStatus)
}
}

Expand Down Expand Up @@ -4352,6 +4346,8 @@ extension BrowserViewController: DevicePickerViewControllerDelegate, Instruction

extension BrowserViewController {
func trackStartupTelemetry() {
let toolbarLocation: SearchBarPosition = self.isBottomSearchBar ? .bottom : .top
SearchBarSettingsViewModel.recordLocationTelemetry(for: toolbarLocation)
trackAccessibility()
trackNotificationPermission()
appStartupTelemetry.sendStartupTelemetry()
Expand Down

0 comments on commit 40f776b

Please sign in to comment.