Skip to content

Instantly share code, notes, and snippets.

@Wottrich
Created May 11, 2021 11:00
Show Gist options
  • Save Wottrich/d343eb49335be92882f2c36f2f75191b to your computer and use it in GitHub Desktop.
Save Wottrich/d343eb49335be92882f2c36f2f75191b to your computer and use it in GitHub Desktop.
InAppUpdates AppUpdateInfoDefinitionsImpl pt1
class AppUpdateInfoDefinitionsImpl : AppUpdateInfoDefinitions() {
override fun shouldNotifyUpdateVersion() =
(hasUpdateAvailable() && !isNoNotifyUpdateVersion())
private fun hasUpdateAvailable() = /*UpdateAvailability.UPDATE_AVAILABLE*/
appUpdatePertinentInfo?.updateAvailability() == appUpdatePertinentInfo?.updateAvailableValue
private fun isNoNotifyUpdateVersion() =
appUpdatePertinentInfo?.updatePriority() == NO_NOTIFY
override fun isFlexible() =
appUpdatePertinentInfo?.updatePriority() in FLEXIBLE
override fun isImmediate() =
appUpdatePertinentInfo?.updatePriority() in IMMEDIATE
companion object {
private const val NO_NOTIFY = 0
private val FLEXIBLE = 1..3
private val IMMEDIATE = 4..5
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment