Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Change FxNimbus/Nimbus startup sequence #25266

Merged
merged 3 commits into from
May 18, 2022

Conversation

jhugman
Copy link
Contributor

@jhugman jhugman commented May 17, 2022

This is a reup of the #25089 and #25234.

The problem seemed to be two fold:

  1. the first is that the MessagingAction.Restore was being called from the onExperimentsFetched observer method.
  2. the initialization of the Nimbus SDK is now happening earlier, earlier than the registration of the observer.

This caused the message not to be ready for the first display of the home screen, which was caught by the performance test.

The fix is to move the restore action to be dispatched explicitly after the nimbus SDK is ready.

Pull Request checklist

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@jhugman jhugman requested review from a team as code owners May 17, 2022 18:32
Comment on lines 421 to 419
components.analytics.experiments.register(object : NimbusInterface.Observer {
override fun onUpdatesApplied(updated: List<EnrolledExperiment>) {
restore()
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it Ok if we added as part of the existing onUpdatesApplied?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I combined the two observers into one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

}

private fun setupMessaging() {
if (!FeatureFlags.messagingFeature) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhugman is it OK to remove the Settings.isExperimentationEnabled check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you're already checking isExperimentationEnabled in the HomeFragment, in which case I don't know what the desired behaviour is (if the user flips the studies switch, should they start seeing messages immediately, or on the next startup?).

This is a bit strange, but I added back in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit confusing. To make sure users are in a consistent state when they turn on/off experiments, we let them know if they proceed the app will restart.

image

Copy link
Contributor

@Amejia481 Amejia481 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested manually and it works expected.
I would prefer if we could reuse the existing event listener, instead of introducing a new one, I also tested this alternative and it worked as expected too.

@jhugman jhugman force-pushed the jhugman/exp-2395-change-fxnimbus-initialization branch from c36d989 to a627077 Compare May 18, 2022 12:40
@jhugman jhugman added the pr:needs-landing-squashed PRs that are ready to land (squashed) [Will be merged by Mergify] label May 18, 2022
@mergify mergify bot merged commit 30fa801 into main May 18, 2022
@bors bors bot deleted the jhugman/exp-2395-change-fxnimbus-initialization branch May 18, 2022 13:23
Comment on lines -59 to -60
FxNimbus.api = NimbusDisabled(testContext)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does removing this do exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The api property is no longer public; this is no longer the way we want to initialize the FxNimbus object.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr:needs-landing-squashed PRs that are ready to land (squashed) [Will be merged by Mergify]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants