Package org.vaadin.firitin.util
Class Share
java.lang.Object
org.vaadin.firitin.util.Share
Deprecated, for removal: This API element is subject to removal in a future version.
A simple wrapper for the Web Share API. Allows sharing text and URLs quickly via OS
native share dialog, if the browser supports the Web Share (~ all but FF).
On Firefox (which does not support the Web Share API), it falls back to copying the text and URL to the clipboard and showing a notification on the screen.
See also: https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDeprecated, for removal: This API element is subject to removal in a future version.Part of the deprecatedSharehelper. -
Constructor Summary
ConstructorsConstructorDescriptionShare()Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidsetFirefoxFallbackNotification(Runnable firefoxFallbackNotification) Deprecated, for removal: This API element is subject to removal in a future version.Sets the action executed when the Web Share API is not supported (e.g. on Firefox).static com.vaadin.flow.component.page.PendingJavaScriptResultDeprecated, for removal: This API element is subject to removal in a future version.Share a link using the Web Share API.static com.vaadin.flow.component.page.PendingJavaScriptResultDeprecated, for removal: This API element is subject to removal in a future version.Share a link using the Web Share API.static com.vaadin.flow.component.page.PendingJavaScriptResultshare(Share.ShareData data) Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
Share
public Share()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
setFirefoxFallbackNotification
Deprecated, for removal: This API element is subject to removal in a future version.Sets the action executed when the Web Share API is not supported (e.g. on Firefox). By default, it shows a notification that the URL has been copied to clipboard. Use e.g. to show a custom message.- Parameters:
firefoxFallbackNotification- the action to execute when the Web Share API is not supported.
-
com.vaadin.flow.component.webshare.WebShare. Arm sharing withWebShare.onClick(button).share(content, onSuccess, onError)(once at construction, within the user-gesture window) and build the payload withShareContent.create().title(..).text(..).url(..); feature detection is viaWebShare.supportSignal().Migration caveat: this Viritin
Sharehas a built-in fallback for browsers without the API (notably Firefox desktop), configurable viasetFirefoxFallbackNotification(Runnable). The nativeWebSharehas no built-in fallback — you must handle theUNSUPPORTEDcase yourself viaWebShare.supportSignal()so the fallback behavior is not silently lost.