diff --git a/app/views/SettingsView/index.js b/app/views/SettingsView/index.js index 4ed1599a2..e6601737e 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, Text, Share + View, Linking, ScrollView, AsyncStorage, SafeAreaView, Switch, Text, Share, Clipboard } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; @@ -31,6 +31,8 @@ import { themedHeader } from '../../utils/navigation'; import SidebarView from '../SidebarView'; import { withSplit } from '../../split'; import Navigation from '../../lib/Navigation'; +import { LISTENER } from '../../containers/Toast'; +import EventEmitter from '../../utils/events'; const SectionSeparator = React.memo(({ theme }) => ( { + const { server } = this.props; + this.saveToClipboard(server.version); + } + + copyAppVersion = () => { + this.saveToClipboard(getReadableVersion); + } + + saveToClipboard = async(content) => { + await Clipboard.setString(content); + EventEmitter.emit(LISTENER, { message: I18n.t('Copied_to_clipboard') }); + } + changeTheme = () => { const { navigation } = this.props; navigation.navigate('ThemeView'); @@ -267,11 +283,19 @@ class SettingsView extends React.Component { right={this.renderDisclosure} theme={theme} /> - - + + + +