diff --git a/app/constants/links.js b/app/constants/links.js new file mode 100644 index 0000000000000000000000000000000000000000..15c045a7cebddbc660407e0764f6983c2e463192 --- /dev/null +++ b/app/constants/links.js @@ -0,0 +1,3 @@ +export const PLAY_MARKET_LINK = 'https://play.google.com/store/apps/details?id=chat.rocket.reactnative'; +export const APP_STORE_LINK = 'https://itunes.apple.com/app/rocket-chat-experimental/id1272915472?ls=1&mt=8'; +export const LICENSE_LINK = 'https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/develop/LICENSE'; diff --git a/app/views/SettingsView/index.js b/app/views/SettingsView/index.js index 3f77e3c2de173f4ecc0eed0b57df94732440d70d..c1c49da0067403de7735f6f464b2484dc45ef6aa 100644 --- a/app/views/SettingsView/index.js +++ b/app/views/SettingsView/index.js @@ -1,6 +1,6 @@ import React from 'react'; import { - View, Linking, ScrollView, AsyncStorage, SafeAreaView, Switch + View, Linking, ScrollView, AsyncStorage, SafeAreaView, Switch, Share } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; @@ -14,14 +14,14 @@ import { DisclosureImage } from '../../containers/DisclosureIndicator'; import Separator from '../../containers/Separator'; import I18n from '../../i18n'; import { MARKDOWN_KEY } from '../../lib/rocketchat'; -import { getReadableVersion, getDeviceModel } from '../../utils/deviceInfo'; +import { getReadableVersion, getDeviceModel, isAndroid } from '../../utils/deviceInfo'; import openLink from '../../utils/openLink'; import scrollPersistTaps from '../../utils/scrollPersistTaps'; import { showErrorAlert } from '../../utils/info'; import styles from './styles'; import sharedStyles from '../Styles'; +import { PLAY_MARKET_LINK, APP_STORE_LINK, LICENSE_LINK } from '../../constants/links'; -const LICENSE_LINK = 'https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/develop/LICENSE'; const SectionSeparator = React.memo(() => <View style={styles.sectionSeparatorBorder} />); class SettingsView extends React.Component { @@ -62,6 +62,10 @@ class SettingsView extends React.Component { } } + shareApp = () => { + Share.share({ message: isAndroid ? PLAY_MARKET_LINK : APP_STORE_LINK }); + } + onPressLicense = () => openLink(LICENSE_LINK) renderDisclosure = () => <DisclosureImage /> @@ -105,18 +109,19 @@ class SettingsView extends React.Component { /> <Separator /> <ListItem - title={I18n.t('Theme')} + title={I18n.t('Share_this_app')} + onPress={this.shareApp} showActionIndicator - disabled - testID='settings-view-theme' + testID='settings-view-share-app' /> <Separator /> <ListItem - title={I18n.t('Share_this_app')} + title={I18n.t('Theme')} showActionIndicator disabled - testID='settings-view-share-app' + testID='settings-view-theme' /> + <Separator /> <SectionSeparator />