feat(GODT-2552): Send first heartbeat.

This commit is contained in:
Romain LE JEUNE
2023-04-18 16:52:15 +02:00
committed by Romain Le Jeune
parent 0f621d0aad
commit b250d49af8
8 changed files with 169 additions and 50 deletions

View File

@ -20,6 +20,7 @@ package vault
import (
"math"
"math/rand"
"time"
"github.com/Masterminds/semver/v3"
"github.com/ProtonMail/proton-bridge/v3/internal/updater"
@ -256,3 +257,15 @@ func (vault *Vault) SetLastUserAgent(userAgent string) error {
data.Settings.LastUserAgent = userAgent
})
}
// GetLastHeartbeatSent returns the last time heartbeat was sent.
func (vault *Vault) GetLastHeartbeatSent() time.Time {
return vault.get().Settings.LastHeartbeatSent
}
// SetLastHeartbeatSent store the last time heartbeat was sent.
func (vault *Vault) SetLastHeartbeatSent(timestamp time.Time) error {
return vault.mod(func(data *Data) {
data.Settings.LastHeartbeatSent = timestamp
})
}