bridge

package
v2.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: GPL-3.0 Imports: 32 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 // MaxAttachmentSize 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,
	tls *tls.TLS,
	userAgent *useragent.UserAgent,
	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) ConfigureAppleMail added in v2.4.0

func (b *Bridge) ConfigureAppleMail(userID, address string) (bool, error)

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) Get added in v2.4.0

func (b *Bridge) Get(key settings.Key) string

func (*Bridge) GetBool added in v2.4.0

func (b *Bridge) GetBool(key settings.Key) bool

func (*Bridge) GetCurrentUserAgent added in v2.4.0

func (b *Bridge) GetCurrentUserAgent() string
func (b *Bridge) GetDependencyLicensesLink() string

func (*Bridge) GetInt added in v2.4.0

func (b *Bridge) GetInt(key settings.Key) int

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) GetLicenseFilePath added in v2.4.0

func (b *Bridge) GetLicenseFilePath() string

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) GetTLSConfig added in v2.4.0

func (b *Bridge) GetTLSConfig() (*tls.Config, error)

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) IsAllMailVisible added in v2.3.0

func (b *Bridge) IsAllMailVisible() bool

IsAllMailVisible can be called extensively by IMAP. Therefore, it is better to cache the value instead of reading from settings file.

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) ProvideLogsPath added in v2.4.0

func (b *Bridge) ProvideLogsPath() (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) Set added in v2.4.0

func (b *Bridge) Set(key settings.Key, value string)

func (*Bridge) SetBool added in v2.4.0

func (b *Bridge) SetBool(key settings.Key, value bool)

func (*Bridge) SetCurrentPlatform added in v2.4.0

func (b *Bridge) SetCurrentPlatform(platform string)

func (*Bridge) SetInt added in v2.4.0

func (b *Bridge) SetInt(key settings.Key, value int)

func (*Bridge) SetIsAllMailVisible added in v2.3.0

func (b *Bridge) SetIsAllMailVisible(isVisible bool)

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 {
	ProvideLogsPath() (string, error)

	GetLicenseFilePath() string
	GetDependencyLicensesLink() string

	Clear() error
	ClearUpdates() error
}

type SettingsProvider

type SettingsProvider interface {
	Get(key settings.Key) string
	Set(key settings.Key, value string)

	GetBool(key settings.Key) bool
	SetBool(key settings.Key, val bool)

	GetInt(key settings.Key) int
	SetInt(key settings.Key, val 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