share playback
This commit is contained in:
+2
-28
@@ -1,12 +1,9 @@
|
||||
import numbro from "numbro";
|
||||
import { Clipboard } from "react-native-web";
|
||||
import moment from "moment";
|
||||
import numbro from "numbro";
|
||||
|
||||
import alert from "../components/Alert.js";
|
||||
|
||||
import { Linking } from "react-native";
|
||||
import { isTauri, isWeb } from "../hooks/useLayoutType";
|
||||
import Palette from "../styles/Palette.js";
|
||||
import { Linking, Share } from "react-native";
|
||||
|
||||
export const capitalize = (string) => {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
@@ -196,26 +193,3 @@ export const openLinkInBrowser = ({ url }) => {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const shareLink = ({ url, title = "", message = "" }) => {
|
||||
try {
|
||||
if (isWeb) {
|
||||
if (!Clipboard.isAvailable) {
|
||||
throw new Error("Clipboard not available");
|
||||
}
|
||||
|
||||
Clipboard.setString(url);
|
||||
|
||||
alert("Lien copié", "Le lien a été copié dans votre presse-papiers.");
|
||||
} else {
|
||||
Share.share({
|
||||
message,
|
||||
url,
|
||||
title,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
alert("Partage non disponible", "Il y a eu une erreur lors du partage.");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user