-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Settings API
To provide a clean and consistent API for settings and storage we need to be clear about what is application local (user preferences) vs global (system settings). Also some things can be set by environment variables to override settings.
For the sections below about app storage we will require a App.UniqueID which will have to be set through a new constructor or directly on the app instance. Global settings can function without this addition. This could be added without breaking the existing API and helpful errors can indicate when storage functions are used without an appropriate identifier set.
A key value store of primitive preferences for an application. All basic types can be stored with simple typed APIs.
Access a user configuration string that was stored previously.
Allows an application to store a user configuration string for later access.
Additional typed versions (like GetFloat or SetBool) should be added to avoid conversions.
We should support complex types as well - the underlying struct must support JSON marshalling - exported types will be persisted and the Go language tags for json can be used to configure how it is stored.
Access a user configuration that was stored previously.
A proposed extension would allow encrypted storage of application secret preferences.
A place where an application can store user documents - within the standard user documents directory. This will usually be a simple filesystem abstraction but may vary across different platforms.
Create a new (empty) document with a simple string identifier (like filename).
Load an existing document from it's identifier. Will error if the document does not exist.
Delete a named document from the storage.
Return a list of available documents for the given application.
The correct location to cache documents or assets that you don't want to keep in memory.
Create a new cache entry with specified name and content.
Get the content of a named cache entry.
Clear the content of a named cache entry.
Merged for 1.2
The items in this section have been implemented
The settings API for fyne provides information about global values. These can be configured by the user of a system. Some of these values can be overridden by the application.
The user can set their preferred theme that will apply to applications if they don't override.
It can be overridden by the user with FYNE_THEME
.
It can also be set by the application if the developer wants to use a custom theme.
An application can listen to changes in global settings. This will occur if a user changes their settings like by using the fyne_settings helper.