aboutsummaryrefslogtreecommitdiff
path: root/src/utils/common.ts
diff options
context:
space:
mode:
authorAshm Walia <40498934+ashmgarv@users.noreply.github.com>2020-12-07 15:27:27 -0800
committerGitHub <noreply@github.com>2020-12-07 18:27:27 -0500
commit5de44211bbadb451b5951eb3f77658d9bab42bc5 (patch)
tree367392891ec880fc24b58d56eb00d70cd95d15b6 /src/utils/common.ts
parent6d1dedb676ff42d18b4e4892ae0c62e76cd1a6c4 (diff)
[TMA - 431] Make socials browsable (#134)
* Open socials apart from twitter on browser * Revert "Open socials apart from twitter on browser" This reverts commit 5b6626811ab7cf9a944b22a1d1d5c4047fe47c64. * Open socials apart from twitter on browser * Fixed * make twitter round * Make some more placeholders browsable Co-authored-by: Ivan Chen <ivan@tagg.id>
Diffstat (limited to 'src/utils/common.ts')
-rw-r--r--src/utils/common.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/utils/common.ts b/src/utils/common.ts
index 9e74ca33..ae83ad9c 100644
--- a/src/utils/common.ts
+++ b/src/utils/common.ts
@@ -1,4 +1,5 @@
-import {TOGGLE_BUTTON_TYPE} from '../constants';
+import {Linking} from 'react-native';
+import {BROWSABLE_SOCIAL_URLS, TOGGLE_BUTTON_TYPE} from '../constants';
export const getToggleButtonText: (
button_type: string,
@@ -13,3 +14,12 @@ export const getToggleButtonText: (
return null;
}
};
+
+export const handleOpenSocialUrlOnBrowser = (
+ handle: string | undefined,
+ social: string,
+) => {
+ if (handle && social in BROWSABLE_SOCIAL_URLS) {
+ Linking.openURL(BROWSABLE_SOCIAL_URLS[social] + `${handle}/`);
+ }
+};