[IMPROVEMENT] Tap app and server version to copy to clipboard (#1425)
This commit is contained in:
parent
f1fcdf7379
commit
9084f22ab1
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {
|
import {
|
||||||
View, Linking, ScrollView, AsyncStorage, SafeAreaView, Switch, Text, Share
|
View, Linking, ScrollView, AsyncStorage, SafeAreaView, Switch, Text, Share, Clipboard
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
@ -31,6 +31,8 @@ import { themedHeader } from '../../utils/navigation';
|
||||||
import SidebarView from '../SidebarView';
|
import SidebarView from '../SidebarView';
|
||||||
import { withSplit } from '../../split';
|
import { withSplit } from '../../split';
|
||||||
import Navigation from '../../lib/Navigation';
|
import Navigation from '../../lib/Navigation';
|
||||||
|
import { LISTENER } from '../../containers/Toast';
|
||||||
|
import EventEmitter from '../../utils/events';
|
||||||
|
|
||||||
const SectionSeparator = React.memo(({ theme }) => (
|
const SectionSeparator = React.memo(({ theme }) => (
|
||||||
<View
|
<View
|
||||||
|
@ -131,6 +133,20 @@ class SettingsView extends React.Component {
|
||||||
Share.share({ message: isAndroid ? PLAY_MARKET_LINK : APP_STORE_LINK });
|
Share.share({ message: isAndroid ? PLAY_MARKET_LINK : APP_STORE_LINK });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copyServerVersion = () => {
|
||||||
|
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 = () => {
|
changeTheme = () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
navigation.navigate('ThemeView');
|
navigation.navigate('ThemeView');
|
||||||
|
@ -267,11 +283,19 @@ class SettingsView extends React.Component {
|
||||||
right={this.renderDisclosure}
|
right={this.renderDisclosure}
|
||||||
theme={theme}
|
theme={theme}
|
||||||
/>
|
/>
|
||||||
<Separator theme={theme} />
|
|
||||||
<ListItem title={I18n.t('Version_no', { version: getReadableVersion })} testID='settings-view-version' theme={theme} />
|
|
||||||
<Separator theme={theme} />
|
<Separator theme={theme} />
|
||||||
|
<ListItem
|
||||||
|
title={I18n.t('Version_no', { version: getReadableVersion })}
|
||||||
|
onPress={this.copyAppVersion}
|
||||||
|
testID='settings-view-version'
|
||||||
|
theme={theme}
|
||||||
|
/>
|
||||||
|
<Separator theme={theme} />
|
||||||
|
|
||||||
<ListItem
|
<ListItem
|
||||||
title={I18n.t('Server_version', { version: server.version })}
|
title={I18n.t('Server_version', { version: server.version })}
|
||||||
|
onPress={this.copyServerVersion}
|
||||||
subtitle={`${ server.server.split('//')[1] }`}
|
subtitle={`${ server.server.split('//')[1] }`}
|
||||||
testID='settings-view-server-version'
|
testID='settings-view-server-version'
|
||||||
theme={theme}
|
theme={theme}
|
||||||
|
|
Loading…
Reference in New Issue