diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 66a278580a8..bff577ec52b 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget object Versions { - const val appVersion = "3.3.0-dev-g" + const val appVersion = "3.3.0.0" const val versionCode = 1500 const val ndkVersion = "21.1.6352462" diff --git a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt index e0adae48206..aa007e63eb9 100644 --- a/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt +++ b/plugins/constraints/src/main/kotlin/app/aaps/plugins/constraints/versionChecker/VersionCheckerUtilsImpl.kt @@ -50,17 +50,19 @@ class VersionCheckerUtilsImpl @Inject constructor( try { val definition: String = URL("https://raw.githubusercontent.com/nightscout/AndroidAPS/versions/definition.json").readText() val version: String? = AllowedVersions().findByApi(definition, Build.VERSION.SDK_INT)?.optString("supported") - compareWithCurrentVersion(version, config.get().VERSION_NAME) + val newVersionAvailable = compareWithCurrentVersion(version, config.get().VERSION_NAME) // App expiration - var endDate = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, 0) - AllowedVersions().findByVersion(definition, config.get().VERSION_NAME)?.let { expirationJson -> - AllowedVersions().endDateToMilliseconds(expirationJson.getString("endDate"))?.let { ed -> - endDate = ed + T.days(1).msecs() - sp.putLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, endDate) + if (newVersionAvailable) { + var endDate = sp.getLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, 0) + AllowedVersions().findByVersion(definition, config.get().VERSION_NAME)?.let { expirationJson -> + AllowedVersions().endDateToMilliseconds(expirationJson.getString("endDate"))?.let { ed -> + endDate = ed + T.days(1).msecs() + sp.putLong(rh.gs(app.aaps.core.utils.R.string.key_app_expiration) + "_" + config.get().VERSION_NAME, endDate) + } } + if (endDate != 0L) onExpireDateDetected(config.get().VERSION_NAME, dateUtil.dateString(endDate)) } - if (endDate != 0L) onExpireDateDetected(config.get().VERSION_NAME, dateUtil.dateString(endDate)) } catch (e: IOException) { aapsLogger.error(LTag.CORE, "Github master version check error: $e")