-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Cloud Integration
You can find the continuation of this work at https://github.com/fyne-io/proposals/pull/4
Part of a complete software ecosystem is the ability for apps to stay in sync. Through preference and/or document transfer users can be editing/reading/playing on one device, move to another and continue where they left off. With a truly cross-platform toolkit like Fyne this should be seamless across all devices.
In addition to the vision that it should be free and simple to develop an application we must strive to make usage of the applications developed under this technology equally democratised. As such any sync solution should, be available to everybody for free or as cheap as possible for the level of functionality delivered.
It is possible that this solution may involve various levels of functionality, for example someone just looking to sync their preferences could perhaps get this for free. However an individual or business working with classified documents that must remain encrypted may wish to pay more for a more sophisticated service.
The popular platforms now have cloud integration, this is essential in many cases and nice to have in a majority. To remain competitive this is an integration we should offer. In most cases the cloud is tied to the platform, but as a platform-agnostic toolkit we need to be able to offer a way for the cloud provision to work on any device. As a platform that is democratising access to techology we also need to provide choice.
The balance we need to maintain is providing functionality without vendor lock-in. Offering user choice whilst not adding complexity or weight to the fyne toolkit.
The main goals should be to:
- Support trivial-to-add cloud services to the toolkit
- Allow users to pick their service provider
- Also allow a developer to specify their own if required (for example in corporate apps etc)
- Keep platform-specific code out of the main toolkit, only included if a developer chooses to have it in their app.
-
CloudProvider interface
- ProviderName
- ProviderIcon
- ProviderDescription
-
CloudSync interface
- SetupCloudPreferences(fyne.App) fyne.Preferences
-
CloudStorage interface
- SetupCloudStorage(fyne.App) fyne.Storage
-
App.SetCloudProvider(CloudProvider) // configure cloud for this app
-
App.CloudProvider() CloudProvider // get the (if any) configured provider
probably a place for lots of docs and information about implementing etc. :)
- CloudProviders() []fyne.CloudProvider
- RegisterProvider(fyne.CloudProvider)
This package imports all of the known providers.
- EnableCloud(fyne.App)
- PresentCloudChoice(fyne.App, fyne.Window)
NewXxxCloud fyne.CloudProvider
- fyne.App.SetPreferences(fyne.Preferences) - Cloud providers can offer preference implementations which the developer can register with the fyne app.
- fyne.App.SetPreferenceURI(fyne.URI) - Fyne reads & writes preferences to a fyne.URI, cloud providers can register a fyne.Repository with a custom scheme, eg.
cloud://fyne.preferences
Andy:
-
Compare the above with a single entry-point API
App.SetCloudProvider(fyne.CloudProvider)
that is available to those who want to code in a specific provider, and is the entry point for our cloud helper package to configure based on user choice. -
A new
fyne.io/cloud
package could provide multiple providers (for example infyne.io/cloud/provider/google
) but more importantly offer a single entry point for the user to choose their provider, likecloud.ShowProviderChoice(win)
which could open a dialog over the current window. It may be required that the developer set up cloud on starting the app as well, such ascloud.LoadChosenProvider()
, before callingRun()
orShowAndRun()
. In this way the app can delegate all choice to the user and all configuration to thecloud
package.