GODT-1978: Auto-updates

This commit is contained in:
James Houlahan
2022-11-01 21:44:09 +01:00
parent 1e29a5210f
commit d093488522
16 changed files with 299 additions and 184 deletions

View File

@ -18,12 +18,24 @@
package cli
import (
"github.com/ProtonMail/proton-bridge/v2/internal/events"
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
"github.com/abiosoft/ishell"
)
func (f *frontendCLI) checkUpdates(c *ishell.Context) {
updateCh, done := f.bridge.GetEvents(events.UpdateAvailable{}, events.UpdateNotAvailable{})
defer done()
f.bridge.CheckForUpdates()
switch (<-updateCh).(type) {
case events.UpdateAvailable:
// ... this is handled by the main event loop
case events.UpdateNotAvailable:
f.Println("Bridge is already up to date.")
}
}
func (f *frontendCLI) enableAutoUpdates(c *ishell.Context) {