From ae2558deef198f5573ad2d6a3594e48e3fcfcd14 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 4 Nov 2021 13:50:14 +0100 Subject: [PATCH] expire after specified date --- .../constraints/versionChecker/VersionCheckerUtils.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt b/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt index be6b4626f0..ce9d6a7ab1 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/constraints/versionChecker/VersionCheckerUtils.kt @@ -10,6 +10,7 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.receivers.ReceiverStatusStore import info.nightscout.androidaps.utils.DateUtil +import info.nightscout.androidaps.utils.T import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.sharedPreferences.SP import java.io.IOException @@ -63,8 +64,8 @@ class VersionCheckerUtils @Inject constructor( var endDate = sp.getLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0) AllowedVersions().findByVersion(definition, config.VERSION_NAME)?.let { expirationJson -> AllowedVersions().endDateToMilliseconds(expirationJson.getString("endDate"))?.let { ed -> - sp.putLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, ed) - endDate = ed + endDate = ed + T.days(1).msecs() + sp.putLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, endDate) } } if (endDate != 0L) onExpiredVersionDetected(config.VERSION_NAME, dateUtil.dateString(endDate))