From bbe6bf8fc2f94b5f3aad03c7c356e2a34ae6f124 Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Mon, 5 Dec 2022 15:03:42 -0600
Subject: Add 'copy post text' tool

---
 src/view/com/post-thread/PostThreadItem.tsx | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src/view/com/post-thread/PostThreadItem.tsx')

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}>
-- 
cgit 1.4.1

