Bluesky app fork with some witchin' additions 馃挮
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at cope-settings-sync 46 lines 1.4 kB view raw
1import {Share} from 'react-native' 2// import * as Sharing from 'expo-sharing' 3import {setStringAsync} from 'expo-clipboard' 4import {t} from '@lingui/core/macro' 5 6import * as Toast from '#/components/Toast' 7import {IS_ANDROID, IS_IOS} from '#/env' 8 9/** 10 * This function shares a URL using the native Share API if available, or copies it to the clipboard 11 * and displays a toast message if not (mostly on web) 12 * @param {string} url - A string representing the URL that needs to be shared or copied to the 13 * clipboard. 14 */ 15export async function shareUrl(url: string) { 16 if (IS_ANDROID) { 17 await Share.share({message: url}) 18 } else if (IS_IOS) { 19 await Share.share({url}) 20 } else { 21 // React Native Share is not supported by web. Web Share API 22 // has increasing but not full support, so default to clipboard 23 setStringAsync(url) 24 Toast.show(t`Copied to clipboard`, { 25 type: 'success', 26 }) 27 } 28} 29 30/** 31 * This function shares a text using the native Share API if available, or copies it to the clipboard 32 * and displays a toast message if not (mostly on web) 33 * 34 * @param {string} text - A string representing the text that needs to be shared or copied to the 35 * clipboard. 36 */ 37export async function shareText(text: string) { 38 if (IS_ANDROID || IS_IOS) { 39 await Share.share({message: text}) 40 } else { 41 await setStringAsync(text) 42 Toast.show(t`Copied to clipboard`, { 43 type: 'success', 44 }) 45 } 46}