support

package
v1.0.31-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package support lets the app's users report a problem and support its development.

Report opens a form whose reports become GitHub issues through a small relay you deploy (see support/relay: a Cloudflare Worker), so users need no GitHub account and the token never ships in the app. Donate opens your donation page (Ko-fi, say), or, where the store requires its own payments (the App Store, the Mac App Store, Google Play), a sheet of tips sold as consumable in-app purchases.

help := support.New(app, support.Options{
	ReportURL: "https://support.example.workers.dev/report",
	App:       "sonora",
	DonateURL: "https://ko-fi.com/you",
	Tips:      []string{"tip_small", "tip_medium", "tip_large"},
})
reportButton := giode.Button("Report a problem").OnClick(help.Report)
donateButton := giode.Button("Donate").OnClick(help.Donate)

// In the view: the button where it belongs, and help anywhere (it
// takes no space, and paints its sheets over the window).
giode.Stack(giode.Styles{}, page, help)

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("support: invalid report")

ErrInvalid is returned for a report the relay would turn away: no app or title, or a description too long.

Functions

func Send

func Send(ctx context.Context, url, key string, r Report) (string, error)

Send posts r to the relay at url and returns the issue's address.

Types

type Options

type Options struct {
	// ReportURL is the relay's report address, ending in /report.
	ReportURL string
	// App names the app to the relay, which maps it to a repository:
	// one relay serves all your apps. Default giode.AppID.
	App string
	// Key, when set, is sent with each report for the relay's KEY to
	// check: it keeps out reports not sent by your apps. It ships in the
	// app, so it stops casual spam, not a determined sender.
	Key string
	// Name is the app's name in the forms; default giode.AppName.
	Name string
	// DonateURL is the page Donate opens: "https://ko-fi.com/you".
	DonateURL string
	// Tips are the ids of consumable in-app products Donate offers
	// instead of DonateURL where the store requires its own payments
	// (store.BillingRequired). Create them in App Store Connect and the
	// Play Console; they're shown in this order, with the store's
	// titles and prices.
	Tips []string
	// Logs, when set, returns recent log lines the form offers to
	// attach.
	Logs func() string
	// Toasts shows the forms' confirmations and errors; by default
	// Support shows them in a toaster of its own.
	Toasts *giode.ToasterElement
}

Options configures the report form and Donate.

type Report

type Report struct {
	App         string `json:"app"`
	Title       string `json:"title"`
	Description string `json:"description"`
	// Email is for replies: the relay keeps it out of the issue.
	Email string `json:"email,omitempty"`
	// The app and system, when the user agrees to include them.
	Version   string `json:"version,omitempty"`
	Build     string `json:"build,omitempty"`
	OS        string `json:"os,omitempty"`
	OSVersion string `json:"os_version,omitempty"`
	Arch      string `json:"arch,omitempty"`
	Model     string `json:"model,omitempty"`
	Locale    string `json:"locale,omitempty"`
	// Crash is the text of a crash report (see package crash), Logs
	// recent log lines.
	Crash string `json:"crash,omitempty"`
	Logs  string `json:"logs,omitempty"`
}

Report is a problem report, as the relay receives it.

func (*Report) System

func (r *Report) System()

System fills in the app and system fields: the app's version and build, the OS, its version, the CPU, the device model and the locale.

type Support

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

Support is the report form and the tips sheet. Lay it out anywhere in the view: it takes no space and paints its sheets over the window.

func New

func New(a *giode.App, o Options) *Support

New returns the report form and the tips sheet for o.

func (*Support) CanDonate

func (s *Support) CanDonate() bool

CanDonate reports whether Donate has something to offer here: tips where the store requires its own payments, the donation page elsewhere. Hide the Donate button when it's false.

func (*Support) Donate

func (s *Support) Donate()

Donate opens the tips sheet where the store requires its own payments, and the donation page elsewhere.

func (*Support) FinishTip

func (s *Support) FinishTip(p store.Purchase) bool

FinishTip finishes p if it's a tip, consuming it so it can be given again, and thanks the user; it reports whether p was a tip.

func (*Support) Layout

func (s *Support) Layout(gtx layout.Context) layout.Dimensions

Layout lays out the open sheets and, unless Options.Toasts was given, the toasts.

func (*Support) OutOfFlow

func (s *Support) OutOfFlow()

OutOfFlow marks Support as taking no space in a Box.

func (*Support) Report

func (s *Support) Report()

Report opens the report form.

Jump to

Keyboard shortcuts

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