Eliminate use of Date()

This commit is contained in:
Milos Kozak 2022-06-23 15:25:17 +02:00
parent 1b7ae4e704
commit f0a37d64f3
6 changed files with 65 additions and 81 deletions

View file

@ -148,7 +148,7 @@ class MaintenancePlugin @Inject constructor(
* @return * @return
*/ */
private fun constructName(): String { private fun constructName(): String {
return "AndroidAPS_LOG_" + Date().time + loggerUtils.suffix return "AndroidAPS_LOG_" + System.currentTimeMillis() + loggerUtils.suffix
} }
private fun zip(zipFile: File?, files: List<File>) { private fun zip(zipFile: File?, files: List<File>) {

View file

@ -5,7 +5,7 @@ import java.text.SimpleDateFormat
import java.util.* import java.util.*
class EventNSClientNewLog(var action: String, var logText: String) : Event() { class EventNSClientNewLog(var action: String, var logText: String) : Event() {
var date = Date() var date = System.currentTimeMillis()
private var timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault()) private var timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault())

View file

@ -85,6 +85,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
rh: ResourceHelper, rh: ResourceHelper,
commandQueue: CommandQueue commandQueue: CommandQueue
) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump { ) : PumpPluginBase(pluginDescription, injector, aapsLogger, rh, commandQueue), Pump {
@Volatile var bolusCanceled = false @Volatile var bolusCanceled = false
@Volatile var bolusDeliveryInProgress = false @Volatile var bolusDeliveryInProgress = false
@ -95,6 +96,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
private var disposables: CompositeDisposable = CompositeDisposable() private var disposables: CompositeDisposable = CompositeDisposable()
companion object { companion object {
private const val BOLUS_RETRY_INTERVAL_MS = 2000.toLong() private const val BOLUS_RETRY_INTERVAL_MS = 2000.toLong()
private const val BOLUS_RETRIES = 5 // number of retries for cancel/get bolus status private const val BOLUS_RETRIES = 5 // number of retries for cancel/get bolus status
private const val STATUS_CHECK_INTERVAL_MS = (60L * 1000) private const val STATUS_CHECK_INTERVAL_MS = (60L * 1000)
@ -460,22 +462,10 @@ class OmnipodDashPumpPlugin @Inject constructor(
.observeOn(aapsSchedulers.main) .observeOn(aapsSchedulers.main)
.subscribe( .subscribe(
{ {
if (it.isChanged( if (it.isChanged(rh, R.string.key_omnipod_common_expiration_reminder_enabled) ||
rh, it.isChanged(rh, R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown) ||
R.string.key_omnipod_common_expiration_reminder_enabled it.isChanged(rh, R.string.key_omnipod_common_low_reservoir_alert_enabled) ||
) || it.isChanged(rh, R.string.key_omnipod_common_low_reservoir_alert_units)
it.isChanged(
rh,
R.string.key_omnipod_common_expiration_reminder_hours_before_shutdown
) ||
it.isChanged(
rh,
R.string.key_omnipod_common_low_reservoir_alert_enabled
) ||
it.isChanged(
rh,
R.string.key_omnipod_common_low_reservoir_alert_units
)
) { ) {
commandQueue.customCommand(CommandUpdateAlertConfiguration(), null) commandQueue.customCommand(CommandUpdateAlertConfiguration(), null)
} }
@ -519,7 +509,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
override val baseBasalRate: Double override val baseBasalRate: Double
get() { get() {
val date = Date() val date = System.currentTimeMillis()
val ret = podStateManager.basalProgram?.rateAt(date) ?: 0.0 val ret = podStateManager.basalProgram?.rateAt(date) ?: 0.0
aapsLogger.info(LTag.PUMP, "baseBasalRate: $ret at $date}") aapsLogger.info(LTag.PUMP, "baseBasalRate: $ret at $date}")
return if (podStateManager.alarmType != null) { return if (podStateManager.alarmType != null) {
@ -626,20 +616,15 @@ class OmnipodDashPumpPlugin @Inject constructor(
) )
} else { } else {
if (podStateManager.activeCommand != null) { if (podStateManager.activeCommand != null) {
val sound = if (sp.getBoolean( val sound =
R.string if (sp.getBoolean(
.key_omnipod_common_notification_uncertain_bolus_sound_enabled, R.string
true .key_omnipod_common_notification_uncertain_bolus_sound_enabled, true
) )
) ) R.raw.boluserror
R.raw.boluserror else 0
else
0
showErrorDialog( showErrorDialog("Bolus delivery status uncertain. Refresh pod status to confirm or deny.", sound)
"Bolus delivery status uncertain. Refresh pod status to confirm or deny.",
sound
)
} }
} }
}.toSingle { }.toSingle {
@ -1000,12 +985,9 @@ class OmnipodDashPumpPlugin @Inject constructor(
val extended = JSONObject() val extended = JSONObject()
try { try {
val podStatus = when { val podStatus = when {
podStateManager.isPodRunning && podStateManager.isSuspended -> podStateManager.isPodRunning && podStateManager.isSuspended -> "suspended"
"suspended" podStateManager.isPodRunning -> "normal"
podStateManager.isPodRunning -> else -> "no active Pod"
"normal"
else ->
"no active Pod"
} }
status.put("status", podStatus) status.put("status", podStatus)
status.put("timestamp", dateUtil.toISOString(podStateManager.lastUpdatedSystem)) status.put("timestamp", dateUtil.toISOString(podStateManager.lastUpdatedSystem))
@ -1108,21 +1090,22 @@ class OmnipodDashPumpPlugin @Inject constructor(
override fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult { override fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult {
return when (customCommand) { return when (customCommand) {
is CommandSilenceAlerts -> is CommandSilenceAlerts ->
silenceAlerts() silenceAlerts()
is CommandResumeDelivery -> is CommandResumeDelivery ->
resumeDelivery() resumeDelivery()
is CommandDeactivatePod -> is CommandDeactivatePod ->
deactivatePod() deactivatePod()
is CommandHandleTimeChange -> is CommandHandleTimeChange ->
handleTimeChange() handleTimeChange()
is CommandUpdateAlertConfiguration -> is CommandUpdateAlertConfiguration ->
updateAlertConfiguration() updateAlertConfiguration()
is CommandPlayTestBeep -> is CommandPlayTestBeep ->
playTestBeep() playTestBeep()
is CommandDisableSuspendAlerts -> is CommandDisableSuspendAlerts ->
disableSuspendAlerts() disableSuspendAlerts()
else -> {
else -> {
aapsLogger.warn(LTag.PUMP, "Unsupported custom command: " + customCommand.javaClass.name) aapsLogger.warn(LTag.PUMP, "Unsupported custom command: " + customCommand.javaClass.name)
PumpEnactResult(injector).success(false).enacted(false).comment( PumpEnactResult(injector).success(false).enacted(false).comment(
rh.gs( rh.gs(
@ -1231,10 +1214,11 @@ class OmnipodDashPumpPlugin @Inject constructor(
expirationHours, expirationHours,
lowReservoirAlertEnabled, lowReservoirAlertEnabled,
lowReservoirAlertUnits lowReservoirAlertUnits
) -> { ) -> {
aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because the settings did not change") aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because the settings did not change")
return PumpEnactResult(injector).success(true).enacted(false) return PumpEnactResult(injector).success(true).enacted(false)
} }
!podStateManager.isPodRunning -> { !podStateManager.isPodRunning -> {
aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because there is no active pod") aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because there is no active pod")
return PumpEnactResult(injector).success(true).enacted(false) return PumpEnactResult(injector).success(true).enacted(false)
@ -1356,7 +1340,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
} }
rxBus.send(EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS)) rxBus.send(EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS))
} }
OmnipodCommandType.RESUME_DELIVERY -> {
OmnipodCommandType.RESUME_DELIVERY -> {
// We can't invalidate this command, // We can't invalidate this command,
// and this is why it is pumpSync-ed at this point // and this is why it is pumpSync-ed at this point
if (confirmation.success) { if (confirmation.success) {
@ -1375,7 +1360,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
} }
} }
OmnipodCommandType.SET_BASAL_PROFILE -> { OmnipodCommandType.SET_BASAL_PROFILE -> {
if (confirmation.success) { if (confirmation.success) {
podStateManager.basalProgram = command.basalProgram podStateManager.basalProgram = command.basalProgram
if (podStateManager.basalProgram == null) { if (podStateManager.basalProgram == null) {
@ -1399,7 +1384,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
} }
} }
OmnipodCommandType.SET_TEMPORARY_BASAL -> { OmnipodCommandType.SET_TEMPORARY_BASAL -> {
// This treatment was synced before sending the command // This treatment was synced before sending the command
if (!confirmation.success) { if (!confirmation.success) {
aapsLogger.info(LTag.PUMPCOMM, "temporary basal denied. PumpId: ${historyEntry.pumpId()}") aapsLogger.info(LTag.PUMPCOMM, "temporary basal denied. PumpId: ${historyEntry.pumpId()}")
@ -1414,7 +1399,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
rxBus.send(EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS)) rxBus.send(EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS))
} }
OmnipodCommandType.SUSPEND_DELIVERY -> { OmnipodCommandType.SUSPEND_DELIVERY -> {
if (!confirmation.success) { if (!confirmation.success) {
pumpSync.invalidateTemporaryBasalWithPumpId( pumpSync.invalidateTemporaryBasalWithPumpId(
historyEntry.pumpId(), historyEntry.pumpId(),
@ -1426,7 +1411,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
} }
} }
OmnipodCommandType.SET_BOLUS -> { OmnipodCommandType.SET_BOLUS -> {
if (confirmation.success) { if (confirmation.success) {
if (command.requestedBolus == null) { if (command.requestedBolus == null) {
aapsLogger.error(LTag.PUMP, "Requested bolus not found: $command") aapsLogger.error(LTag.PUMP, "Requested bolus not found: $command")
@ -1459,7 +1444,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
rxBus.send(EventDismissNotification(Notification.OMNIPOD_UNCERTAIN_SMB)) rxBus.send(EventDismissNotification(Notification.OMNIPOD_UNCERTAIN_SMB))
} }
OmnipodCommandType.CANCEL_BOLUS -> { OmnipodCommandType.CANCEL_BOLUS -> {
if (confirmation.success) { if (confirmation.success) {
podStateManager.lastBolus?.run { podStateManager.lastBolus?.run {
val deliveredUnits = markComplete() val deliveredUnits = markComplete()
@ -1481,7 +1466,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
} }
} }
else -> else ->
aapsLogger.warn( aapsLogger.warn(
LTag.PUMP, LTag.PUMP,
"Will not sync confirmed command of type: $historyEntry and " + "Will not sync confirmed command of type: $historyEntry and " +
@ -1508,13 +1493,13 @@ class OmnipodDashPumpPlugin @Inject constructor(
private fun soundEnabledForNotificationType(notificationType: Int): Boolean { private fun soundEnabledForNotificationType(notificationType: Int): Boolean {
return when (notificationType) { return when (notificationType) {
Notification.OMNIPOD_TBR_ALERTS -> Notification.OMNIPOD_TBR_ALERTS ->
sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_tbr_sound_enabled, true) sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_tbr_sound_enabled, true)
Notification.OMNIPOD_UNCERTAIN_SMB -> Notification.OMNIPOD_UNCERTAIN_SMB ->
sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_smb_sound_enabled, true) sp.getBoolean(R.string.key_omnipod_common_notification_uncertain_smb_sound_enabled, true)
Notification.OMNIPOD_POD_SUSPENDED -> Notification.OMNIPOD_POD_SUSPENDED ->
sp.getBoolean(R.string.key_omnipod_common_notification_delivery_suspended_sound_enabled, true) sp.getBoolean(R.string.key_omnipod_common_notification_delivery_suspended_sound_enabled, true)
else -> true else -> true
} }
} }
} }

View file

@ -15,9 +15,9 @@ class BasalProgram(
fun hasZeroUnitSegments() = segments.any { it.basalRateInHundredthUnitsPerHour == 0 } fun hasZeroUnitSegments() = segments.any { it.basalRateInHundredthUnitsPerHour == 0 }
fun rateAt(date: Date): Double { fun rateAt(date: Long): Double {
val instance = Calendar.getInstance() val instance = Calendar.getInstance()
instance.time = date instance.timeInMillis = date
val hourOfDay = instance[Calendar.HOUR_OF_DAY] val hourOfDay = instance[Calendar.HOUR_OF_DAY]
val minuteOfHour = instance[Calendar.MINUTE] val minuteOfHour = instance[Calendar.MINUTE]
val slotIndex = hourOfDay * 2 + minuteOfHour.div(30) val slotIndex = hourOfDay * 2 + minuteOfHour.div(30)

View file

@ -13,6 +13,7 @@ import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.activities.ErrorHelperActivity import info.nightscout.androidaps.activities.ErrorHelperActivity
import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.events.EventPumpStatusChanged import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.PumpSync import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.interfaces.ResourceHelper
@ -39,7 +40,6 @@ import info.nightscout.androidaps.queue.events.EventQueueChanged
import info.nightscout.androidaps.utils.DateUtil import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.interfaces.BuildHelper
import info.nightscout.androidaps.utils.protection.ProtectionCheck import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.ui.UIRunnable import info.nightscout.androidaps.utils.ui.UIRunnable
@ -52,7 +52,6 @@ import java.time.ZonedDateTime
import java.util.* import java.util.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Inject import javax.inject.Inject
import kotlin.collections.ArrayList
// TODO generify; see OmnipodErosOverviewFragment // TODO generify; see OmnipodErosOverviewFragment
class OmnipodDashOverviewFragment : DaggerFragment() { class OmnipodDashOverviewFragment : DaggerFragment() {
@ -274,7 +273,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
R.attr.warningColor R.attr.warningColor
connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 -> connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
R.attr.omniYellowColor R.attr.omniYellowColor
else -> else ->
R.attr.defaultTextColor R.attr.defaultTextColor
} }
) )
@ -343,9 +342,9 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
when { when {
!podStateManager.sameTimeZone -> !podStateManager.sameTimeZone ->
R.attr.omniMagentaColor R.attr.omniMagentaColor
timeDeviationTooBig -> timeDeviationTooBig ->
R.attr.omniYellowColor R.attr.omniYellowColor
else -> else ->
R.attr.defaultTextColor R.attr.defaultTextColor
} }
) )
@ -361,11 +360,11 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
rh.gac( rh.gac(
context, context,
when { when {
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) -> expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) ->
R.attr.warningColor R.attr.warningColor
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) -> expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) ->
R.attr.omniYellowColor R.attr.omniYellowColor
else -> else ->
R.attr.defaultTextColor R.attr.defaultTextColor
} }
) )
@ -387,7 +386,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
rh.gs( rh.gs(
R.string.pump_basebasalrate, R.string.pump_basebasalrate,
omnipodDashPumpPlugin.model() omnipodDashPumpPlugin.model()
.determineCorrectBasalSize(podStateManager.basalProgram!!.rateAt(Date())) .determineCorrectBasalSize(podStateManager.basalProgram!!.rateAt(System.currentTimeMillis()))
) )
} else { } else {
PLACEHOLDER PLACEHOLDER
@ -447,21 +446,21 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
private fun translatedActiveAlert(alert: AlertType): String { private fun translatedActiveAlert(alert: AlertType): String {
val id = when (alert) { val id = when (alert) {
AlertType.LOW_RESERVOIR -> AlertType.LOW_RESERVOIR ->
R.string.omnipod_common_alert_low_reservoir R.string.omnipod_common_alert_low_reservoir
AlertType.EXPIRATION -> AlertType.EXPIRATION ->
R.string.omnipod_common_alert_expiration_advisory R.string.omnipod_common_alert_expiration_advisory
AlertType.EXPIRATION_IMMINENT -> AlertType.EXPIRATION_IMMINENT ->
R.string.omnipod_common_alert_expiration R.string.omnipod_common_alert_expiration
AlertType.USER_SET_EXPIRATION -> AlertType.USER_SET_EXPIRATION ->
R.string.omnipod_common_alert_expiration_advisory R.string.omnipod_common_alert_expiration_advisory
AlertType.AUTO_OFF -> AlertType.AUTO_OFF ->
R.string.omnipod_common_alert_shutdown_imminent R.string.omnipod_common_alert_shutdown_imminent
AlertType.SUSPEND_IN_PROGRESS -> AlertType.SUSPEND_IN_PROGRESS ->
R.string.omnipod_common_alert_delivery_suspended R.string.omnipod_common_alert_delivery_suspended
AlertType.SUSPEND_ENDED -> AlertType.SUSPEND_ENDED ->
R.string.omnipod_common_alert_delivery_suspended R.string.omnipod_common_alert_delivery_suspended
else -> else ->
R.string.omnipod_common_alert_unknown_alert R.string.omnipod_common_alert_unknown_alert
} }
return rh.gs(id) return rh.gs(id)
@ -474,7 +473,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
System.currentTimeMillis() - System.currentTimeMillis() -
podStateManager.lastUpdatedSystem, podStateManager.lastUpdatedSystem,
) )
) )
val lastConnectionColor = val lastConnectionColor =
rh.gac( rh.gac(
@ -528,9 +527,9 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
when { when {
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended -> !podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
R.attr.warningColor R.attr.warningColor
podStateManager.activeCommand != null -> podStateManager.activeCommand != null ->
R.attr.omniYellowColor R.attr.omniYellowColor
else -> else ->
R.attr.defaultTextColor R.attr.defaultTextColor
} }
) )
@ -628,7 +627,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
private fun updateRefreshStatusButton() { private fun updateRefreshStatusButton() {
buttonBinding.buttonRefreshStatus.isEnabled = buttonBinding.buttonRefreshStatus.isEnabled =
podStateManager.isUniqueIdSet && podStateManager.isUniqueIdSet &&
isQueueEmpty() isQueueEmpty()
} }
private fun updateResumeDeliveryButton() { private fun updateResumeDeliveryButton() {
@ -695,15 +694,15 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
val minutes = duration.toMinutes().toInt() val minutes = duration.toMinutes().toInt()
val seconds = duration.seconds val seconds = duration.seconds
when { when {
seconds < 10 -> { seconds < 10 -> {
return rh.gs(R.string.omnipod_common_moments_ago) return rh.gs(R.string.omnipod_common_moments_ago)
} }
seconds < 60 -> { seconds < 60 -> {
return rh.gs(R.string.omnipod_common_less_than_a_minute_ago) return rh.gs(R.string.omnipod_common_less_than_a_minute_ago)
} }
seconds < 60 * 60 -> { // < 1 hour seconds < 60 * 60 -> { // < 1 hour
return rh.gs( return rh.gs(
R.string.omnipod_common_time_ago, R.string.omnipod_common_time_ago,
rh.gq(R.plurals.omnipod_common_minutes, minutes, minutes) rh.gq(R.plurals.omnipod_common_minutes, minutes, minutes)
@ -727,7 +726,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
) )
} }
else -> { else -> {
val days = hours / 24 val days = hours / 24
val hoursLeft = hours % 24 val hoursLeft = hours % 24
if (hoursLeft > 0) if (hoursLeft > 0)

View file

@ -247,12 +247,12 @@ class OpenHumansUploader @Inject internal constructor(
tags.add("DisplayInfo") tags.add("DisplayInfo")
val uploadNumber = this.uploadCounter++ val uploadNumber = this.uploadCounter++
val uploadDate = Date() val uploadDate = System.currentTimeMillis()
val uploadInfo = JSONObject() val uploadInfo = JSONObject()
uploadInfo.put("fileVersion", 2) uploadInfo.put("fileVersion", 2)
uploadInfo.put("counter", uploadNumber) uploadInfo.put("counter", uploadNumber)
uploadInfo.put("timestamp", until) uploadInfo.put("timestamp", until)
uploadInfo.put("utcOffset", TimeZone.getDefault().getOffset(uploadDate.time)) uploadInfo.put("utcOffset", TimeZone.getDefault().getOffset(uploadDate))
zos.writeFile("UploadInfo.json", uploadInfo.toString().toByteArray()) zos.writeFile("UploadInfo.json", uploadInfo.toString().toByteArray())
tags.add("UploadInfo") tags.add("UploadInfo")
@ -521,7 +521,7 @@ class OpenHumansUploader @Inject internal constructor(
tags = tags, tags = tags,
description = "AndroidAPS Database Upload", description = "AndroidAPS Database Upload",
md5 = MessageDigest.getInstance("MD5").digest(bytes).toHexString(), md5 = MessageDigest.getInstance("MD5").digest(bytes).toHexString(),
creationDate = uploadDate.time creationDate = uploadDate
) )
refreshAccessTokenIfNeeded() refreshAccessTokenIfNeeded()