cloud

package module
v0.0.0-...-fc981ee Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: BSD-3-Clause Imports: 7 Imported by: 1

README

Fyne Cloud

A repository that helps to manage cloud integrations in a Fyne app. Since Fyne 2.3 developers can provide their own cloud storage to a Fyne app, but if you would like to use standard providers this repository will manage that for you.

There is also the ability to have developers choose cloud provider and configure settings. Just add the following lines to your app:

import "fyne.io/cloud"

func main() {
   	a := app.NewWithID("io.fyne.cloud.example")
	cloud.Enable(a)

    ...
}

You would then present the cloud choice UI using a button or menu item that simply calls:

    cloud.ShowSettings(a, w)

Which will render the settings UI as a dialog on the specified window.

Documentation

Overview

Package cloud provides various cloud provider implementations and utilities to add the cloud services into your Fyne app. Developers can choose to load a specific provider, or they can present a configuration user interface allowing the end-user to choose the provider they wish to use.

A simple usage where an app uses AWS for cloud provision may look like this:

package main

import (
	"fyne.io/cloud/provider/aws"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	a.SetCloudProvider(aws.NewProvider()) // if aws provider existed ;)
	w := a.NewWindow("Cloud")

	w.SetContent(widget.NewLabel("Add content here"))
	w.ShowAndRun()
}

Alternatively to allow the user to choose a cloud provider for their storage etc use:

package main

import (
	"fyne.io/cloud"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	cloud.Enable(a)
	w := a.NewWindow("Cloud")

	w.SetContent(widget.NewButton("Choose cloud provider", func() {
		cloud.ShowSettings(a, w)
	}))
	w.ShowAndRun()
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enable

func Enable(a fyne.App)

func Register

func Register(p fyne.CloudProvider)

func ShowSettings

func ShowSettings(a fyne.App, w fyne.Window)

Types

type Configurable

type Configurable interface {
	// Configure requests that the cloud provider show some configuration options as a dialog on the specified window.
	// It returns a serialised configuration or an error.
	Configure(fyne.App, fyne.Window) (string, error)
	// SetConfig is used to apply a previous configuration to this provider.
	SetConfig(string)
}

Configurable interface describes the functions required for a cloud provider to store configuration.

type Disconnectable

type Disconnectable interface {
	// Disconnect the cloud provider from application and ignore future events.
	Disconnect()
}

Disconnectable interface describes a cloud provider that can respond to being disconnected. This is typically used before a replacement provider is loaded.

Directories

Path Synopsis
This file is copied from fyne.io/fyne/internal to avoid an import loop
This file is copied from fyne.io/fyne/internal to avoid an import loop
provider

Jump to

Keyboard shortcuts

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