From d0d24ea248a74df89c0033a2f63787aaa2f0402d Mon Sep 17 00:00:00 2001
From: Ansh Nanda <anshnanda10@gmail.com>
Date: Tue, 25 Apr 2023 13:45:46 -0700
Subject: consolidated share code to shareUrl

---
 src/view/com/util/forms/DropdownButton.tsx | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

(limited to 'src/view/com/util/forms/DropdownButton.tsx')

diff --git a/src/view/com/util/forms/DropdownButton.tsx b/src/view/com/util/forms/DropdownButton.tsx
index fcb209005..725d45c1b 100644
--- a/src/view/com/util/forms/DropdownButton.tsx
+++ b/src/view/com/util/forms/DropdownButton.tsx
@@ -1,7 +1,6 @@
 import React, {useRef} from 'react'
 import {
   Dimensions,
-  Share,
   StyleProp,
   StyleSheet,
   TouchableOpacity,
@@ -19,10 +18,8 @@ import {toShareUrl} from 'lib/strings/url-helpers'
 import {useStores} from 'state/index'
 import {usePalette} from 'lib/hooks/usePalette'
 import {useTheme} from 'lib/ThemeContext'
-import {isAndroid, isIOS} from 'platform/detection'
-import Clipboard from '@react-native-clipboard/clipboard'
-import * as Toast from '../../util/Toast'
 import {isWeb} from 'platform/detection'
+import {shareUrl} from 'lib/sharing'
 
 const HITSLOP = {left: 10, top: 10, right: 10, bottom: 10}
 const ESTIMATED_BTN_HEIGHT = 50
@@ -182,15 +179,7 @@ export function PostDropdownBtn({
       label: 'Share...',
       onPress() {
         const url = toShareUrl(itemHref)
-
-        if (isIOS || isAndroid) {
-          Share.share({url})
-        } else {
-          // React Native Share is not supported by web. Web Share API
-          // has increasing but not full support, so default to clipboard
-          Clipboard.setString(url)
-          Toast.show('Copied to clipboard')
-        }
+        shareUrl(url)
       },
     },
     {sep: true},
-- 
cgit 1.4.1

