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
What opens the sheet:
- iOS:
UIActivityViewController. - Android: an
ACTION_SENDchooser with aFileProvider. - Web preview:
navigator.share(), 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
trueas 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
TypeErrorwhen there's nothing to share, a file has no name orurlisn't absolute - a
ShareErrorwhen the sheet can't open. One sheet can be open at a time: sharing again while one is open rejects withfailed.
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
Blobwith aname, such as aFilein the web preview, works too. - The name's extension gives the file's type when the
Blobhas none.
