LynxShare
Opens the phone's share sheet, as navigator.share() does on the web. import { LynxShare, ShareError, type ShareData, type ShareFile, type ShareErrorCode } from '@blotch/angular-lynx';
Share Files and Links shows it in use.
Usage
API
LynxShare
Uses UIActivityViewController on iOS, an ACTION_SEND chooser with a FileProvider on Android, and navigator.share() in the web preview, or a download of each file where the browser can't share them. Only the apps --platform builds, with ng build or ng serve, have the native module behind it; elsewhere, such as Lynx Explorer and unit tests, share() rejects with unavailable.
LynxShare.share()
Opens the share sheet and resolves true once the person has shared, or false when they close it without sharing. On Android, which doesn't say whether the person finished in the app they picked, it resolves true as soon as they pick an app. In the web preview, a browser that can't share the files downloads them and resolves true.
Rejects with a TypeError when there's nothing to share, a file has no name or url isn't absolute, and with a ShareError when the sheet can't open. One sheet can be open at a time: sharing again while one is open rejects with failed.
ShareData
Give at least one of them.
ShareFile
A Blob and the file's name, such as photo.jpg. Lynx has no File class, so the name goes beside the Blob, the shape LynxImagePicker's PickedImage has. A Blob with a name, such as a File in the web preview, works too. The name's extension gives the file's type when the Blob has none.
