Created
May 11, 2021 11:00
-
-
Save Wottrich/d343eb49335be92882f2c36f2f75191b to your computer and use it in GitHub Desktop.
InAppUpdates AppUpdateInfoDefinitionsImpl pt1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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