Skip to content

Instantly share code, notes, and snippets.

@mattpocock
Last active January 22, 2022 21:11
Show Gist options
  • Save mattpocock/c01aa01b76dff1b7f3a5d586965f2304 to your computer and use it in GitHub Desktop.
Save mattpocock/c01aa01b76dff1b7f3a5d586965f2304 to your computer and use it in GitHub Desktop.

Build the logic for a network quality indicator:

Requirements:

  1. Every time the REPORT_NETWORK_QUALITY event comes in, I want to assign its results to context (no matter what else happens)
  2. If the network quality is bad or worse, we want to show a warning
  3. If the network quality gets better, we want to hide the warning again
  4. The warning must show for a minimum of 2 seconds, we don't want any weird flickering.
  5. The user should be able to dismiss the warning forever using the DISMISS_NETWORK_QUALITY_WARNING. The warning should never show again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment