2019-02-15 06:26:28 +01:00
|
|
|
import { toast } from '../_components/toast/toast'
|
|
|
|
import { statusHtmlToPlainText } from '../_utils/statusHtmlToPlainText'
|
2020-11-29 23:13:27 +01:00
|
|
|
import { formatIntl } from '../_utils/formatIntl'
|
2019-02-15 06:26:28 +01:00
|
|
|
|
|
|
|
export async function shareStatus (status) {
|
|
|
|
try {
|
|
|
|
await navigator.share({
|
|
|
|
title: status.spoiler_text || undefined,
|
|
|
|
text: statusHtmlToPlainText(status.content, status.mentions),
|
|
|
|
url: status.url
|
|
|
|
})
|
|
|
|
} catch (e) {
|
2020-11-29 23:13:27 +01:00
|
|
|
/* no await */ toast.say(formatIntl('intl.unableToShare', { error: (e.message || '') }))
|
2019-02-15 06:26:28 +01:00
|
|
|
}
|
|
|
|
}
|