• Danny Tuppeny's avatar
    Improve update checking (#18193) · e616c6ce
    Danny Tuppeny authored
    * Improve update checking
    
    This change emables pinging the server to check for updates regardless of whether the local version is "out of date". The server code already has a 7-day cache so the result is that we can now ping the server once every 7 days instead of waiting for the local install to be 4 weeks out of date before pinging.
    
    The original 4 week period is still used for when we'll start warning the user they're out of date if we could not confirm with the server whether there's a new version.
    
    * Improve message when we know there's a new version available
    
    * Fix bnullable bool checks
    
    * Switch nullable bool to enum
    
    * Fix casing of enum values
    
    * Remove stale comment
    
    The names are now descriptive so doesn't need additional explanation.
    
    * Improve name of function
    
    * Remove note:
    
    * Rename kPauseToLetUserReadTheMessage -> timeToPauseToLetUserReadTheMessage
    
    * Change kVersionAgeConsideredUpToDate to 5 weeks from 4
    
    * Inline the isNewerFrameworkVersionAvailable check
    
    * Fix indenting (?)
    
    * Fix more indenting
    
    * Rename function to be clearer it's getting the commit date
    
    * Formating tweaks
    
    * Update stamp when connection failed, and reduce time before we'll try again
    
    Previously we would hit the server on every command if we thought we might be out of date and we never successfully connected (eg. if you're offline). This makes the stamp update even when there's a conneciton failure so that this won't happen, but reduces the time till we check again from 7 days to 3 days to compensate a little in case it was a one-off.
    
    https://github.com/flutter/flutter/pull/18193#issuecomment-399222269
    
    * Fix comment
    
    * Don't perform update checks if not on an official channel
    e616c6ce
version_test.dart 17.1 KB