diff --git a/package.json b/package.json index 80c650a00..e96aa368b 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "react-native-gesture-handler": "^1.10.3", "react-native-get-random-values": "^1.7.0", "react-native-gifted-chat": "^0.16.3", + "react-native-hyperlink": "^0.0.19", "react-native-image-picker": "^3.7.0", "react-native-linear-gradient": "^2.5.6", "react-native-material-menu": "^1.2.0", diff --git a/src/Screens/chat.js b/src/Screens/chat.js index 1fe695372..070c0d8a2 100644 --- a/src/Screens/chat.js +++ b/src/Screens/chat.js @@ -71,7 +71,6 @@ import downloadFile from '../helpers/downloadFileLogic'; import FastImage from 'react-native-fast-image'; import {updateMessageObject} from '../components/realmModels/messages'; import {commonColors, textStyles} from '../../docs/config'; -import {RNCamera} from 'react-native-camera'; import VideoRecorder from 'react-native-beautiful-video-recorder'; import parseChatLink from '../helpers/parseChatLink'; import openChatFromChatLink from '../helpers/openChatFromChatLink'; diff --git a/src/Screens/profileScreen.js b/src/Screens/profileScreen.js index 346393fcf..0f79b9009 100644 --- a/src/Screens/profileScreen.js +++ b/src/Screens/profileScreen.js @@ -26,6 +26,9 @@ import { saveInitialData, saveInitialDataAction } from '../actions/auth'; +import openChatFromChatLink from '../helpers/openChatFromChatLink'; +import parseChatLink from '../helpers/parseChatLink'; +import {setCurrentChatDetails} from '../actions/chatAction'; import {CommonTextInput} from '../components/shared/customTextInputs'; import {connect} from 'react-redux'; @@ -37,6 +40,8 @@ import styles from './style/createNewChatStyle'; import * as connectionURL from '../config/url'; import {Alert} from 'react-native'; import axios from 'axios'; +import Hyperlink from 'react-native-hyperlink' +import AntIcon from 'react-native-vector-icons/AntDesign' import {commonColors, textStyles, coinImagePath, coinsMainName, itemsTransfersAllowed} from '../../docs/config'; const { @@ -896,6 +901,19 @@ class ProfileScreen extends Component { }); }; + handleChatLinks= async(chatLink)=>{ + const walletAddress = this.props.loginReducer.initialData.walletAddress; + const chatJID = parseChatLink(chatLink); + const pattern1 = /\bhttps:\/\/www\.eto\.li\/go\?c=0x[0-9a-f]+_0x[0-9a-f]+/gm + const pattern2 = /\bhttps:\/\/www\.eto\.li\/go\?c=[0-9a-f]+/gm + + if(pattern1.test(chatLink)||pattern2.test(chatLink)){ + openChatFromChatLink(chatJID, walletAddress, this.props.setCurrentChatDetails, this.props.navigation); + }else{ + Linking.openURL(chatLink); + } + } + modalContent = () => { if (this.state.modalTypeForEditing === 'description') { return this.state.isDescriptionEditable ? ( @@ -1130,19 +1148,29 @@ class ProfileScreen extends Component { paddingTop: 0, }}> + this.handleChatLinks(url)} + linkStyle={ { color: '#2980b9', fontSize: hp('1.8%'), textDecorationLine:"underline" } } + > {this.state.description && !this.state.isDescriptionEditable ? this.state.description : 'Add your description'} + + + + {/* {this.state.isDescriptionEditable ? ( @@ -1303,6 +1331,7 @@ module.exports = connect( getUserProfileData, setUserInitialData, saveInitialData, - saveInitialDataAction + saveInitialDataAction, + setCurrentChatDetails }, )(ProfileScreen); diff --git a/yarn.lock b/yarn.lock index d035ea67c..c24ca7497 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5814,6 +5814,13 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= +linkify-it@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-2.2.0.tgz#e3b54697e78bf915c70a38acd78fd09e0058b1cf" + integrity sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw== + dependencies: + uc.micro "^1.0.1" + load-bmfont@^1.3.1, load-bmfont@^1.4.0: version "1.4.1" resolved "https://registry.yarnpkg.com/load-bmfont/-/load-bmfont-1.4.1.tgz#c0f5f4711a1e2ccff725a7b6078087ccfcddd3e9" @@ -6000,6 +6007,11 @@ mdn-data@2.0.14: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow== +mdurl@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4= + merge-options@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-3.0.4.tgz#84709c2aa2a4b24c1981f66c179fe5565cc6dbb7" @@ -7393,6 +7405,14 @@ react-native-gifted-chat@^0.16.3: react-native-typing-animation "^0.1.7" uuid "3.4.0" +react-native-hyperlink@^0.0.19: + version "0.0.19" + resolved "https://registry.yarnpkg.com/react-native-hyperlink/-/react-native-hyperlink-0.0.19.tgz#ca375cde1d244bb94c551736852ee0d688c8bb1f" + integrity sha512-x4wuRGDMnnpWcRr5MCK1D2UcEuzD9IHK8lfjEhO/+QqXNaX31HdeD3ss3BXXZgHxpRYtLbTB0TuFcl1HHANp3w== + dependencies: + linkify-it "^2.2.0" + mdurl "^1.0.0" + react-native-image-picker@^3.7.0: version "3.8.1" resolved "https://registry.yarnpkg.com/react-native-image-picker/-/react-native-image-picker-3.8.1.tgz#6e830e9b69c882ad5f1160e10592a84963a7f2c9" @@ -8985,6 +9005,11 @@ ua-parser-js@^0.7.18: resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.28.tgz#8ba04e653f35ce210239c64661685bf9121dec31" integrity sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g== +uc.micro@^1.0.1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== + uglify-es@^3.1.9: version "3.3.9" resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"