ADD: release notes in about screen

This commit is contained in:
Overtorment 2019-01-30 23:31:20 +00:00 committed by Igor Korsakov
parent 6420c8ee2f
commit 54664b7d33
4 changed files with 68 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import { createStackNavigator, createAppContainer } from 'react-navigation';
import Settings from './screen/settings/settings';
import About from './screen/settings/about';
import Releasenotes from './screen/settings/releasenotes';
import Selftest from './screen/selftest';
import Language from './screen/settings/language';
import Currency from './screen/settings/currency';
@ -86,6 +87,10 @@ const WalletsStackNavigator = createStackNavigator(
screen: About,
path: 'About',
},
Releasenotes: {
screen: Releasenotes,
path: 'Releasenotes',
},
Selftest: {
screen: Selftest,
},

View file

@ -19,10 +19,11 @@
"scripts": {
"prepare": "./patches/fix_mangle.sh; git apply patches/minifier.js.patch; git apply patches/minify.js.patch; git apply patches/transaction_builder.js.patch; git apply ./patches/transaction.js.patch",
"clean": "cd android/; ./gradlew clean; cd ..; rm -r -f /tmp/metro-cache/; rm -r -f node_modules/; npm cache clean --force; npm i; npm start -- --reset-cache",
"releasenotes2json": "./release-notes.sh > release-notes.txt; node -e 'console.log(JSON.stringify(require(\"fs\").readFileSync(\"release-notes.txt\", \"utf8\")));' > release-notes.json",
"start": "node node_modules/react-native/local-cli/cli.js start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path --hack",
"postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path --hack; npm run releasenotes2json",
"test": "npm run unit && npm run jest && npm run lint",
"jest": "node node_modules/jest/bin/jest.js",
"lint": "./node_modules/.bin/eslint *.js screen/**/*.js screen/ class/ models/ loc/ --fix",

View file

@ -127,6 +127,14 @@ export default class About extends Component {
<BlueText h4>* bignumber.js</BlueText>
<BlueSpacing20 />
<BlueButton
onPress={() => {
this.props.navigation.navigate('Releasenotes');
}}
title="Release notes"
/>
<BlueSpacing20 />
<BlueButton
onPress={() => {
this.props.navigation.navigate('Selftest');
@ -135,8 +143,9 @@ export default class About extends Component {
/>
<BlueTextCentered />
<BlueTextCentered>
{DeviceInfo.getApplicationName()} ver {DeviceInfo.getVersion()} (build number {DeviceInfo.getBuildNumber()})
{DeviceInfo.getApplicationName()} ver {DeviceInfo.getVersion()} (build {DeviceInfo.getBuildNumber()})
</BlueTextCentered>
<BlueTextCentered>{new Date(DeviceInfo.getBuildNumber() * 1000).toGMTString()}</BlueTextCentered>
<BlueTextCentered>{DeviceInfo.getBundleId()}</BlueTextCentered>
<BlueTextCentered>
w, h = {width}, {height}

View file

@ -0,0 +1,51 @@
import React, { Component } from 'react';
import { ScrollView } from 'react-native';
import { BlueLoading, SafeBlueArea, BlueCard, BlueText, BlueNavigationStyle } from '../../BlueComponents';
import PropTypes from 'prop-types';
/** @type {AppStorage} */
const notes = require('../../release-notes');
export default class Releasenotes extends Component {
static navigationOptions = () => ({
...BlueNavigationStyle(),
title: 'Release notes',
});
constructor(props) {
super(props);
this.state = {
isLoading: true,
};
}
async componentDidMount() {
console.log(notes);
this.setState({
isLoading: false,
notes: notes,
});
}
render() {
if (this.state.isLoading) {
return <BlueLoading />;
}
return (
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
<ScrollView>
<BlueCard>
<BlueText>{this.state.notes}</BlueText>
</BlueCard>
</ScrollView>
</SafeBlueArea>
);
}
}
Releasenotes.propTypes = {
navigation: PropTypes.shape({
navigate: PropTypes.func,
goBack: PropTypes.func,
}),
};