BlueWallet/screen/settings/about.js

154 lines
4.4 KiB
JavaScript
Raw Normal View History

2019-12-25 10:46:51 -06:00
import React, { useEffect, useState } from 'react';
2019-01-10 21:24:49 -05:00
import { ScrollView, Linking, Dimensions } from 'react-native';
2019-12-25 10:46:51 -06:00
import { useNavigation } from 'react-navigation-hooks';
2018-07-17 23:43:23 +01:00
import {
BlueTextCentered,
BlueLoading,
BlueSpacing20,
BlueButton,
SafeBlueArea,
BlueCard,
BlueText,
BlueNavigationStyle,
} from '../../BlueComponents';
2019-10-22 11:17:08 -04:00
import { getApplicationName, getVersion, getBundleId, getBuildNumber } from 'react-native-device-info';
2019-01-10 21:24:49 -05:00
import Rate, { AndroidMarket } from 'react-native-rate';
2018-03-31 14:43:08 +01:00
/** @type {AppStorage} */
2019-12-25 10:46:51 -06:00
const BlueApp = require('../../BlueApp');
2018-07-17 23:43:23 +01:00
const { width, height } = Dimensions.get('window');
2018-10-30 22:23:48 -04:00
const loc = require('../../loc/');
2018-03-31 14:43:08 +01:00
2019-12-25 10:46:51 -06:00
const About = () => {
const [isLoading, setIsLoading] = useState(true);
const { navigate } = useNavigation();
useEffect(() => {
setIsLoading(false);
});
2018-03-31 14:43:08 +01:00
2019-12-25 10:46:51 -06:00
const handleOnReleaseNotesPress = () => {
navigate('ReleaseNotes');
};
const handleOnSelfTestPress = () => {
navigate('Selftest');
};
const handleOnTwitterPress = () => {
Linking.openURL('https://twitter.com/bluewalletio');
};
const handleOnGithubPress = () => {
Linking.openURL('https://github.com/BlueWallet/BlueWallet');
};
2018-03-31 14:43:08 +01:00
2019-12-25 10:46:51 -06:00
const handleOnTelegramPress = () => {
Linking.openURL('https://t.me/bluewallet');
};
const handleOnRatePress = () => {
const options = {
AppleAppID: '1376878040',
GooglePackageName: 'io.bluewallet.bluewallet',
preferredAndroidMarket: AndroidMarket.Google,
preferInApp: true,
openAppStoreIfInAppFails: true,
fallbackPlatformURL: 'https://bluewallet.io',
};
Rate.rate(options, success => {
if (success) {
console.log('User Rated.');
}
2018-03-31 14:43:08 +01:00
});
2019-12-25 10:46:51 -06:00
};
return isLoading ? (
<BlueLoading />
) : (
<SafeBlueArea forceInset={{ horizontal: 'always' }} style={{ flex: 1 }}>
2020-03-19 15:51:35 +00:00
<ScrollView testID="AboutScrollView">
2019-12-25 10:46:51 -06:00
<BlueCard>
<BlueTextCentered h4>BlueWallet is a free and open source Bitcoin wallet. Licensed MIT.</BlueTextCentered>
<BlueSpacing20 />
<BlueTextCentered h4>Always backup your keys</BlueTextCentered>
<BlueSpacing20 />
<BlueButton
icon={{
name: 'github',
type: 'font-awesome',
color: BlueApp.settings.buttonTextColor,
}}
onPress={handleOnGithubPress}
title="github.com/BlueWallet/BlueWallet"
/>
<BlueSpacing20 />
<BlueButton
icon={{
name: 'twitter',
type: 'font-awesome',
color: BlueApp.settings.buttonTextColor,
}}
onPress={handleOnTwitterPress}
title="Follow us on Twitter"
/>
<BlueSpacing20 />
<BlueButton
icon={{
name: 'telegram',
type: 'font-awesome',
color: BlueApp.settings.buttonTextColor,
}}
onPress={handleOnTelegramPress}
title="Join Telegram chat"
/>
<BlueSpacing20 />
<BlueButton
icon={{
name: 'thumbs-up',
type: 'font-awesome',
color: BlueApp.settings.buttonTextColor,
}}
onPress={handleOnRatePress}
title="Rate BlueWallet"
/>
<BlueSpacing20 />
<BlueText h3>Built with awesome:</BlueText>
<BlueSpacing20 />
<BlueText h4>* React Native</BlueText>
<BlueText h4>* bitcoinjs-lib</BlueText>
2019-12-25 10:46:51 -06:00
<BlueText h4>* Nodejs</BlueText>
<BlueText h4>* Electrum server</BlueText>
<BlueSpacing20 />
2019-12-25 10:46:51 -06:00
<BlueSpacing20 />
<BlueButton onPress={handleOnReleaseNotesPress} title="Release notes" />
<BlueSpacing20 />
2020-03-19 15:51:35 +00:00
<BlueButton onPress={handleOnSelfTestPress} title="Run self test" testID="RunSelfTestButton" />
2019-12-25 10:46:51 -06:00
<BlueTextCentered />
<BlueTextCentered>
{getApplicationName()} ver {getVersion()} (build {getBuildNumber()})
</BlueTextCentered>
<BlueTextCentered>{new Date(getBuildNumber() * 1000).toGMTString()}</BlueTextCentered>
<BlueTextCentered>{getBundleId()}</BlueTextCentered>
<BlueTextCentered>
w, h = {width}, {height}
</BlueTextCentered>
</BlueCard>
</ScrollView>
</SafeBlueArea>
);
2018-03-31 14:43:08 +01:00
};
2019-12-25 10:46:51 -06:00
About.navigationOptions = () => ({
...BlueNavigationStyle(),
title: loc.settings.about,
});
export default About;