about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/view/com/post-thread/PostThreadItem.tsx7
-rw-r--r--src/view/com/post/Post.tsx6
-rw-r--r--src/view/com/posts/FeedItem.tsx6
-rw-r--r--src/view/com/util/DropdownBtn.tsx9
-rw-r--r--src/view/com/util/PostMeta.tsx2
-rw-r--r--src/view/index.ts2
6 files changed, 32 insertions, 0 deletions
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index fcfaba9d4..93cf4be37 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -1,6 +1,7 @@
 import React, {useMemo, useState} from 'react'
 import {observer} from 'mobx-react-lite'
 import {StyleSheet, Text, View} from 'react-native'
+import Clipboard from '@react-native-clipboard/clipboard'
 import {AtUri} from '../../../third-party/uri'
 import * as PostType from '../../../third-party/api/src/client/types/app/bsky/feed/post'
 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
@@ -75,6 +76,10 @@ export const PostThreadItem = observer(function PostThreadItem({
       .toggleUpvote()
       .catch(e => console.error('Failed to toggle upvote', record, e))
   }
+  const onCopyPostText = () => {
+    Clipboard.setString(record.text)
+    Toast.show('Copied to clipboard')
+  }
   const onDeletePost = () => {
     item.delete().then(
       () => {
@@ -130,6 +135,7 @@ export const PostThreadItem = observer(function PostThreadItem({
                   itemHref={itemHref}
                   itemTitle={itemTitle}
                   isAuthor={item.author.did === store.me.did}
+                  onCopyPostText={onCopyPostText}
                   onDeletePost={onDeletePost}>
                   <FontAwesomeIcon
                     icon="ellipsis-h"
@@ -257,6 +263,7 @@ export const PostThreadItem = observer(function PostThreadItem({
               authorDisplayName={item.author.displayName}
               timestamp={item.indexedAt}
               isAuthor={item.author.did === store.me.did}
+              onCopyPostText={onCopyPostText}
               onDeletePost={onDeletePost}
             />
             <View style={styles.postTextContainer}>
diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx
index 2996991e7..23ec44c6b 100644
--- a/src/view/com/post/Post.tsx
+++ b/src/view/com/post/Post.tsx
@@ -8,6 +8,7 @@ import {
   ViewStyle,
 } from 'react-native'
 import {observer} from 'mobx-react-lite'
+import Clipboard from '@react-native-clipboard/clipboard'
 import {AtUri} from '../../../third-party/uri'
 import * as PostType from '../../../third-party/api/src/client/types/app/bsky/feed/post'
 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
@@ -110,6 +111,10 @@ export const Post = observer(function Post({
       .toggleUpvote()
       .catch(e => console.error('Failed to toggle upvote', record, e))
   }
+  const onCopyPostText = () => {
+    Clipboard.setString(record.text)
+    Toast.show('Copied to clipboard')
+  }
   const onDeletePost = () => {
     item.delete().then(
       () => {
@@ -144,6 +149,7 @@ export const Post = observer(function Post({
             authorDisplayName={item.author.displayName}
             timestamp={item.indexedAt}
             isAuthor={item.author.did === store.me.did}
+            onCopyPostText={onCopyPostText}
             onDeletePost={onDeletePost}
           />
           {replyHref !== '' && (
diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx
index 19df5a74d..b34fe239d 100644
--- a/src/view/com/posts/FeedItem.tsx
+++ b/src/view/com/posts/FeedItem.tsx
@@ -1,6 +1,7 @@
 import React, {useMemo, useState} from 'react'
 import {observer} from 'mobx-react-lite'
 import {StyleSheet, Text, View} from 'react-native'
+import Clipboard from '@react-native-clipboard/clipboard'
 import {AtUri} from '../../../third-party/uri'
 import * as PostType from '../../../third-party/api/src/client/types/app/bsky/feed/post'
 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
@@ -66,6 +67,10 @@ export const FeedItem = observer(function FeedItem({
       .toggleUpvote()
       .catch(e => console.error('Failed to toggle upvote', record, e))
   }
+  const onCopyPostText = () => {
+    Clipboard.setString(record.text)
+    Toast.show('Copied to clipboard')
+  }
   const onDeletePost = () => {
     item.delete().then(
       () => {
@@ -147,6 +152,7 @@ export const FeedItem = observer(function FeedItem({
               authorDisplayName={item.author.displayName}
               timestamp={item.indexedAt}
               isAuthor={item.author.did === store.me.did}
+              onCopyPostText={onCopyPostText}
               onDeletePost={onDeletePost}
             />
           ) : undefined}
diff --git a/src/view/com/util/DropdownBtn.tsx b/src/view/com/util/DropdownBtn.tsx
index 98e2f3f2b..b38a6ed99 100644
--- a/src/view/com/util/DropdownBtn.tsx
+++ b/src/view/com/util/DropdownBtn.tsx
@@ -79,6 +79,7 @@ export function PostDropdownBtn({
   itemHref,
   itemTitle,
   isAuthor,
+  onCopyPostText,
   onDeletePost,
 }: {
   style?: StyleProp<ViewStyle>
@@ -86,6 +87,7 @@ export function PostDropdownBtn({
   itemHref: string
   itemTitle: string
   isAuthor: boolean
+  onCopyPostText: () => void
   onDeletePost: () => void
 }) {
   const store = useStores()
@@ -101,6 +103,13 @@ export function PostDropdownBtn({
         }
       : undefined,
     {
+      icon: ['far', 'paste'],
+      label: 'Copy post text',
+      onPress() {
+        onCopyPostText()
+      },
+    },
+    {
       icon: 'share',
       label: 'Share...',
       onPress() {
diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx
index 80dde0e06..1994580c1 100644
--- a/src/view/com/util/PostMeta.tsx
+++ b/src/view/com/util/PostMeta.tsx
@@ -14,6 +14,7 @@ interface PostMetaOpts {
   authorDisplayName: string | undefined
   timestamp: string
   isAuthor: boolean
+  onCopyPostText: () => void
   onDeletePost: () => void
 }
 
@@ -40,6 +41,7 @@ export function PostMeta(opts: PostMetaOpts) {
         itemHref={opts.itemHref}
         itemTitle={opts.itemTitle}
         isAuthor={opts.isAuthor}
+        onCopyPostText={opts.onCopyPostText}
         onDeletePost={opts.onDeletePost}>
         <FontAwesomeIcon icon="ellipsis-h" size={14} style={[s.mt2, s.mr5]} />
       </PostDropdownBtn>
diff --git a/src/view/index.ts b/src/view/index.ts
index 65779bf99..71769471b 100644
--- a/src/view/index.ts
+++ b/src/view/index.ts
@@ -38,6 +38,7 @@ import {faLock} from '@fortawesome/free-solid-svg-icons/faLock'
 import {faMagnifyingGlass} from '@fortawesome/free-solid-svg-icons/faMagnifyingGlass'
 import {faMessage} from '@fortawesome/free-regular-svg-icons/faMessage'
 import {faNoteSticky} from '@fortawesome/free-solid-svg-icons/faNoteSticky'
+import {faPaste} from '@fortawesome/free-regular-svg-icons/faPaste'
 import {faPen} from '@fortawesome/free-solid-svg-icons/faPen'
 import {faPenNib} from '@fortawesome/free-solid-svg-icons/faPenNib'
 import {faPenToSquare} from '@fortawesome/free-solid-svg-icons/faPenToSquare'
@@ -101,6 +102,7 @@ export function setup() {
     faMagnifyingGlass,
     faMessage,
     faNoteSticky,
+    faPaste,
     faPen,
     faPenNib,
     faPenToSquare,