expire after specified date

This commit is contained in:
Milos Kozak 2021-11-04 13:50:14 +01:00
parent 35c6ee38e5
commit ae2558deef

View file

@ -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.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.receivers.ReceiverStatusStore import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.T
import info.nightscout.androidaps.utils.resources.ResourceHelper import info.nightscout.androidaps.utils.resources.ResourceHelper
import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.sharedPreferences.SP
import java.io.IOException 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) var endDate = sp.getLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, 0)
AllowedVersions().findByVersion(definition, config.VERSION_NAME)?.let { expirationJson -> AllowedVersions().findByVersion(definition, config.VERSION_NAME)?.let { expirationJson ->
AllowedVersions().endDateToMilliseconds(expirationJson.getString("endDate"))?.let { ed -> AllowedVersions().endDateToMilliseconds(expirationJson.getString("endDate"))?.let { ed ->
sp.putLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, ed) endDate = ed + T.days(1).msecs()
endDate = ed sp.putLong(rh.gs(R.string.key_app_expiration) + "_" + config.VERSION_NAME, endDate)
} }
} }
if (endDate != 0L) onExpiredVersionDetected(config.VERSION_NAME, dateUtil.dateString(endDate)) if (endDate != 0L) onExpiredVersionDetected(config.VERSION_NAME, dateUtil.dateString(endDate))