class WhatsNew private constructor(private val storage: WhatsNewStorage) { private fun hasBeenUpdatedRecently(currentVersion: WhatsNewVersion): Boolean { val lastKnownAppVersion = storage.getVersion() // Update the version and date if *just* updated if (lastKnownAppVersion == null || currentVersion.majorVersionNumber > lastKnownAppVersion.majorVersionNumber ) { storage.setVersion(currentVersion) storage.setDateOfUpdate(System.currentTimeMillis()) return true } return (!storage.getWhatsNewHasBeenCleared() && storage.getDaysSinceUpdate() < DAYS_PER_UPDATE) } }
Helper class tracking whether the application was recently updated in order to show "What's new" menu items and indicators in the application UI. The application is considered updated when the application's version name changes (versionName in the manifest). The applications version code would be a good candidates too, but it might  change more often (RC builds) without the application actually changing from the user's point of view. Whenever the application was updated we still consider the application to be "recently updated for the next few days.