bridge

package
v2.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2022 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package bridge provides core functionality of Bridge app.

Package bridge provides core functionality of Bridge app.

Index

Constants

View Source
const (
	MaxAttachmentSize       = 7 * 1024 * 1024 // 7 MB total limit
	MaxCompressedFilesCount = 6
)
View Source
const (
	Host = "127.0.0.1"
)

Host settings.

View Source
const ReleaseFixedBugs = `• Fixed sending error caused by inconsistent use of upper and lower case in sender’s email address
`
View Source
const ReleaseNotes = `
`

Variables

View Source
var ErrLocalCacheUnavailable = errors.New("local cache is unavailable")
View Source
var ErrSizeTooLarge = errors.New("file is too big")

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	*users.Users
	// contains filtered or unexported fields
}

func New

func New(
	locations Locator,
	cacheProvider CacheProvider,
	setting SettingsProvider,
	sentryReporter *sentry.Reporter,
	panicHandler users.PanicHandler,
	eventListener listener.Listener,
	cache cache.Cache,
	builder *message.Builder,
	clientManager pmapi.Manager,
	credStorer users.CredentialsStorer,
	updater Updater,
	versioner Versioner,
	autostart *autostart.App,
) *Bridge

func (*Bridge) AddError

func (b *Bridge) AddError(err error)

AddError add an error to a global error list if it does not contain it yet. Adding nil is noop.

func (*Bridge) DelError

func (b *Bridge) DelError(err error)

DelError removes an error from global error list.

func (*Bridge) DisableAutostart

func (b *Bridge) DisableAutostart() error

DisableAutostart removes link and sets the preferences.

func (*Bridge) DisableCache

func (b *Bridge) DisableCache() error

func (*Bridge) EnableAutostart

func (b *Bridge) EnableAutostart() error

EnableAutostart creates link and sets the preferences.

func (*Bridge) EnableCache

func (b *Bridge) EnableCache() error

func (*Bridge) FactoryReset

func (b *Bridge) FactoryReset()

FactoryReset will remove all local cache and settings. It will also downgrade to latest stable version if user is on early version.

func (*Bridge) GetKeychainApp

func (b *Bridge) GetKeychainApp() string

GetKeychainApp returns current keychain helper.

func (*Bridge) GetLastVersion

func (b *Bridge) GetLastVersion() string

GetLastVersion returns the version which was used in previous execution of Bridge.

func (*Bridge) GetProxyAllowed

func (b *Bridge) GetProxyAllowed() bool

GetProxyAllowed returns whether use of DoH is enabled to access an API proxy if necessary.

func (*Bridge) GetUpdateChannel

func (b *Bridge) GetUpdateChannel() updater.UpdateChannel

GetUpdateChannel returns currently set update channel.

func (*Bridge) HasError

func (b *Bridge) HasError(err error) bool

HasError returnes true if global error list contains an err.

func (*Bridge) IsAutostartEnabled

func (b *Bridge) IsAutostartEnabled() bool

IsAutostartEnabled checks if link file exits.

func (*Bridge) IsFirstStart

func (b *Bridge) IsFirstStart() bool

IsFirstStart returns true when Bridge is running for first time or after factory reset.

func (*Bridge) MigrateCache

func (b *Bridge) MigrateCache(from, to string) error

func (*Bridge) ReportBug

func (b *Bridge) ReportBug(osType, osVersion, description, accountName, address, emailClient string, attachLogs bool) error

ReportBug reports a new bug from the user.

func (*Bridge) SetKeychainApp

func (b *Bridge) SetKeychainApp(helper string)

SetKeychainApp sets current keychain helper.

func (*Bridge) SetProxyAllowed

func (b *Bridge) SetProxyAllowed(proxyAllowed bool)

SetProxyAllowed instructs the app whether to use DoH to access an API proxy if necessary. It also needs to work before the app is initialised (because we may need to use the proxy at startup).

func (*Bridge) SetUpdateChannel

func (b *Bridge) SetUpdateChannel(channel updater.UpdateChannel)

SetUpdateChannel switches update channel.

type CacheProvider

type CacheProvider interface {
	GetIMAPCachePath() string
	GetDBDir() string
	GetDefaultMessageCacheDir() string
}

type LimitedBuffer

type LimitedBuffer struct {
	// contains filtered or unexported fields
}

func NewLimitedBuffer

func NewLimitedBuffer(capacity int) *LimitedBuffer

func (*LimitedBuffer) Read

func (b *LimitedBuffer) Read(p []byte) (n int, err error)

func (*LimitedBuffer) Write

func (b *LimitedBuffer) Write(p []byte) (n int, err error)

type Locator

type Locator interface {
	Clear() error
	ClearUpdates() error
	ProvideLogsPath() (string, error)
}

type SettingsProvider

type SettingsProvider interface {
	Get(key string) string
	Set(key string, value string)
	GetBool(key string) bool
	SetBool(key string, val bool)
	GetInt(key string) int
}

type Updater

type Updater interface {
	Check() (updater.VersionInfo, error)
	IsDowngrade(updater.VersionInfo) bool
	InstallUpdate(updater.VersionInfo) error
}

type Versioner

type Versioner interface {
	RemoveOtherVersions(*semver.Version) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL