GODT-1349: Change cache-related settings when enabling/disabling/moving cache

This commit is contained in:
James Houlahan
2021-09-16 20:22:16 +02:00
committed by Jakub
parent 18257f0302
commit 29af8e7178
3 changed files with 45 additions and 18 deletions

View File

@ -204,3 +204,36 @@ func (b *Bridge) GetKeychainApp() string {
func (b *Bridge) SetKeychainApp(helper string) {
b.settings.Set(settings.PreferredKeychainKey, helper)
}
func (b *Bridge) EnableCache() error {
// Set this back to the default location before enabling.
b.settings.Set(settings.CacheLocationKey, "")
if err := b.Users.EnableCache(); err != nil {
return err
}
b.settings.SetBool(settings.CacheEnabledKey, true)
return nil
}
func (b *Bridge) DisableCache() error {
if err := b.Users.DisableCache(); err != nil {
return err
}
b.settings.SetBool(settings.CacheEnabledKey, false)
return nil
}
func (b *Bridge) MigrateCache(from, to string) error {
if err := b.Users.MigrateCache(from, to); err != nil {
return err
}
b.settings.Set(settings.CacheLocationKey, to)
return nil
}