cleanup: Remove restarter

Issue #6
create-reload-action
Lukasz Janyst 4 years ago
parent c7311827ee
commit e4ad38ed18
No known key found for this signature in database
GPG Key ID: 32DE641041F17A9A
  1. 5
      pkg/app/base/base.go
  2. 1
      pkg/app/bridge/bridge.go
  3. 6
      pkg/frontend/cli/accounts.go
  4. 7
      pkg/frontend/cli/frontend.go
  5. 12
      pkg/frontend/cli/system.go
  6. 2
      pkg/frontend/frontend.go
  7. 5
      pkg/frontend/types/types.go

@ -176,8 +176,3 @@ func New( // nolint[funlen]
Name: appName,
}, nil
}
// SetToRestart sets the app to restart the next time it is closed.
func (b *Base) SetToRestart() {
b.restart = true
}

@ -100,7 +100,6 @@ func MailLoop(b *base.Base) error { // nolint[funlen]
b.Settings,
b.Listener,
bridge,
b,
)
return f.Loop()

@ -21,10 +21,10 @@ import (
"context"
"strings"
"github.com/abiosoft/ishell"
"github.com/ljanyst/peroxide/pkg/bridge"
"github.com/ljanyst/peroxide/pkg/config/settings"
"github.com/ljanyst/peroxide/pkg/frontend/types"
"github.com/abiosoft/ishell"
)
func (f *frontendCLI) listAccounts(c *ishell.Context) {
@ -213,10 +213,6 @@ func (f *frontendCLI) deleteEverything(c *ishell.Context) {
f.bridge.FactoryReset()
c.Println("Everything cleared")
// Clearing data removes everything (db, preferences, ...) so everything has to be stopped and started again.
f.restarter.SetToRestart()
f.Stop()
}

@ -40,8 +40,6 @@ type frontendCLI struct {
settings *settings.Settings
eventListener listener.Listener
bridge types.Bridger
restarter types.Restarter
}
// New returns a new CLI frontend configured with the given options.
@ -50,7 +48,6 @@ func New( //nolint[funlen]
settings *settings.Settings,
eventListener listener.Listener,
bridge types.Bridger,
restarter types.Restarter,
) *frontendCLI { //nolint[golint]
fe := &frontendCLI{
Shell: ishell.New(),
@ -59,8 +56,6 @@ func New( //nolint[funlen]
settings: settings,
eventListener: eventListener,
bridge: bridge,
restarter: restarter,
}
// Clear commands.
@ -252,5 +247,3 @@ func (f *frontendCLI) Loop() error {
f.Run()
return nil
}
func (f *frontendCLI) WaitUntilFrontendIsReady() {}

@ -23,9 +23,9 @@ import (
"strconv"
"strings"
"github.com/abiosoft/ishell"
"github.com/ljanyst/peroxide/pkg/config/settings"
"github.com/ljanyst/peroxide/pkg/ports"
"github.com/abiosoft/ishell"
)
var (
@ -35,7 +35,6 @@ var (
func (f *frontendCLI) restart(c *ishell.Context) {
if f.yesNoQuestion("Are you sure you want to restart the Bridge") {
f.Println("Restarting Bridge...")
f.restarter.SetToRestart()
f.Stop()
}
}
@ -66,10 +65,6 @@ func (f *frontendCLI) deleteCache(c *ishell.Context) {
}
f.Println("Cached cleared, restarting bridge")
// Clearing data removes everything (db, preferences, ...) so everything has to be stopped and started again.
f.restarter.SetToRestart()
f.Stop()
}
@ -88,7 +83,6 @@ func (f *frontendCLI) changeSMTPSecurity(c *ishell.Context) {
if f.yesNoQuestion(msg) {
f.settings.SetBool(settings.SMTPSSLKey, !isSSL)
f.Println("Restarting Bridge...")
f.restarter.SetToRestart()
f.Stop()
}
}
@ -121,7 +115,6 @@ func (f *frontendCLI) changePort(c *ishell.Context) {
f.settings.Set(settings.IMAPPortKey, newIMAPPort)
f.settings.Set(settings.SMTPPortKey, newSMTPPort)
f.Println("Restarting Bridge...")
f.restarter.SetToRestart()
f.Stop()
} else {
f.Println("Nothing changed")
@ -166,7 +159,6 @@ func (f *frontendCLI) enableCacheOnDisk(c *ishell.Context) {
return
}
f.restarter.SetToRestart()
f.Stop()
}
}
@ -183,7 +175,6 @@ func (f *frontendCLI) disableCacheOnDisk(c *ishell.Context) {
return
}
f.restarter.SetToRestart()
f.Stop()
}
}
@ -204,7 +195,6 @@ func (f *frontendCLI) setCacheOnDiskLocation(c *ishell.Context) {
return
}
f.restarter.SetToRestart()
f.Stop()
}
}

@ -37,7 +37,6 @@ func New(
settings *settings.Settings,
eventListener listener.Listener,
bridge *bridge.Bridge,
restarter types.Restarter,
) Frontend {
bridgeWrap := types.NewBridgeWrap(bridge)
return cli.New(
@ -45,6 +44,5 @@ func New(
settings,
eventListener,
bridgeWrap,
restarter,
)
}

@ -23,11 +23,6 @@ import (
"github.com/ljanyst/peroxide/pkg/pmapi"
)
// Restarter allows the app to set itself to restart next time it is closed.
type Restarter interface {
SetToRestart()
}
type NoEncConfirmator interface {
ConfirmNoEncryption(string, bool)
}

Loading…
Cancel
Save