share

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: BSD-3-Clause, MIT Imports: 1 Imported by: 0

README

share

Go Reference

Opens the share dialog to share texts and websites.


Usage

Freestanding

  • share.NewShare:
    • Creates a instance of Share struct, given the config.
  • share.Configure:
    • Updates the current Share with the given config.
  • share.Text:
    • Shares text using the native share dialog.
  • share.Website:
    • Shares a website using the native share dialog.

Gio

Non-Plugin:

If you want to use it without plugin, read the Freestanding instructions. We provide some helper functions, such as NewConfigFromViewEvent and such.

Plugin:

Operations:

Operations must be added with .Add(gtx.Ops) method. The operation will be executed at the end of the frame.

  • gioshare.TextOp:
    • Shares text using the native share dialog.
  • gioshare.WebsiteOp:
    • Shares a website using the native share dialog.

Events:

Events are response sent using the Tag and should be handled with gtx.Events().

  • gioshare.ErrorEvent:
    • Sent to Tag when it's not possible to share.

Features

OS Windows Android MacOS iOS WebAssembly
Share Text
Share Website
Share Image
-- -- -- -- -- --
API DataTransfer Intent.ACTION_SEND NSSharingServicePicker UIActivityViewController Web Share API
  • ❌ = Not supported.
  • ✔ = Supported.

Requirements

  • Windows:
    • End-Users: must have Windows 10+.
    • Developers: must have Golang 1.18+ installed (no CGO required).
  • WebAssembly:
    • End-Users: must have WebAssembly enabled browser (usually Safari 13+, Chrome 70+).
    • Developers: must have Golang 1.18+ installed (no CGO required).
  • macOS:
    • End-Users: must have macOS 12+.
    • Developers: must have macOS device with Golang, Xcode, and CLang installed.
  • iOS:
    • End-Users: must have macOS 13+.
    • Developers: must have macOS device with Golang, Xcode, and CLang installed.
  • Android:
    • End-Users: must have Android 6+.
    • Developers: must have Golang 1.18+, OpenJDK 1.8, Android NDK, Android SDK 31 installed (here for more information).

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotAvailable is return when the current OS isn't supported.
	ErrNotAvailable = errors.New("current OS not supported")

	// ErrNotAvailableAction is return when the current Shareable item isn't supported.
	ErrNotAvailableAction = errors.New("current shareable item not supported")
)

Functions

This section is empty.

Types

type Config

type Config struct{}

Config is the configuration for a WebView.

type Share

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

func NewShare

func NewShare(config Config) *Share

func (*Share) Configure

func (s *Share) Configure(config Config)

func (*Share) Text

func (s *Share) Text(title, desc string) error

func (*Share) Website

func (s *Share) Website(title, desc, link string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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