Documentation
¶
Overview ¶
Package receiveshare puts your app in the share sheet, so people can send it text, links, pictures and files from other apps.
nimbus native plugin add receive-share
go receiveshare.Watch(ctx, receiveshare.Options{}, func(s receiveshare.Share) {
if s.URL != "" {
save(s.URL)
}
for _, f := range s.Files {
upload(f.Name, f.Data)
}
})
On Android, the share opens your app. On iOS it goes through a Share Extension, which plugin add puts in the Xcode project: the person sees a short "Sent" sheet and stays where they were, and the share waits for your app's next time on screen. iOS doesn't let a share extension open its app.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
Name string `json:"name"` // its file name
Type string `json:"type"` // its media type, such as "image/jpeg"
Size int64 `json:"size"` // in bytes
// Data is its contents, or empty when it's larger than Options.MaxBytes.
Data []byte `json:"data"`
}
File is a shared file. It comes as bytes, so it works under `nimbus native dev` too.
type Options ¶
type Options struct {
// MaxBytes is the largest file that comes with its Data; 0 means 20 MB.
// Larger ones still come, with their name, type and size.
MaxBytes int64 `json:"maxBytes,omitempty"`
}
Options say what to take.
Click to show internal directories.
Click to hide internal directories.