BlueWallet/screen/settings/about.js

201 lines
5.5 KiB
JavaScript
Raw Normal View History

2020-10-07 08:24:36 -04:00
import React from 'react';
import { ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions } from 'react-native';
2020-07-15 13:32:59 -04:00
import { useNavigation, useTheme } from '@react-navigation/native';
2018-07-17 23:43:23 +01:00
import {
BlueTextCentered,
BlueSpacing20,
BlueButton,
SafeBlueArea,
BlueCard,
2020-09-21 21:53:28 -04:00
BlueListItem,
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';
2020-07-20 16:38:46 +03:00
import loc from '../../loc';
2019-12-25 10:46:51 -06:00
const About = () => {
const { navigate } = useNavigation();
2020-07-15 13:32:59 -04:00
const { colors } = useTheme();
2020-10-07 08:24:36 -04:00
const { width, height } = useWindowDimensions();
2020-07-15 13:32:59 -04:00
const styles = StyleSheet.create({
root: {
flex: 1,
},
center: {
justifyContent: 'center',
alignItems: 'center',
marginTop: 54,
},
logo: {
width: 102,
height: 124,
},
textFree: {
maxWidth: 260,
marginVertical: 24,
color: '#9AA0AA',
fontSize: 15,
textAlign: 'center',
fontWeight: '500',
},
textBackup: {
maxWidth: 260,
marginBottom: 40,
color: colors.foregroundColor,
fontSize: 15,
textAlign: 'center',
fontWeight: '500',
},
buildWith: {
backgroundColor: colors.inputBackgroundColor,
padding: 16,
paddingTop: 0,
borderRadius: 8,
},
});
2019-12-25 10:46:51 -06:00
const handleOnReleaseNotesPress = () => {
navigate('ReleaseNotes');
};
const handleOnSelfTestPress = () => {
navigate('Selftest');
};
2020-03-31 21:13:48 +02:00
const handleOnLicensingPress = () => {
navigate('Licensing');
};
2019-12-25 10:46:51 -06:00
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
};
2020-10-07 08:24:36 -04:00
return (
<SafeBlueArea style={styles.root}>
2020-03-19 15:51:35 +00:00
<ScrollView testID="AboutScrollView">
2019-12-25 10:46:51 -06:00
<BlueCard>
<View style={styles.center}>
<Image style={styles.logo} source={require('../../img/bluebeast.png')} />
2020-07-20 16:38:46 +03:00
<Text style={styles.textFree}>{loc.settings.about_free}</Text>
<Text style={styles.textBackup}>{loc.settings.about_backup}</Text>
<BlueButton onPress={handleOnRatePress} title={loc.settings.about_review + ' ⭐🙏'} />
2020-03-31 20:10:49 +02:00
</View>
</BlueCard>
2020-09-21 21:53:28 -04:00
<BlueListItem
2020-03-31 20:10:49 +02:00
leftIcon={{
name: 'twitter',
type: 'font-awesome',
2020-03-31 20:16:22 +02:00
color: '#1da1f2',
2020-03-31 20:10:49 +02:00
}}
onPress={handleOnTwitterPress}
2020-07-20 16:38:46 +03:00
title={loc.settings.about_sm_twitter}
2020-03-31 20:10:49 +02:00
/>
2020-09-21 21:53:28 -04:00
<BlueListItem
2020-03-31 20:10:49 +02:00
leftIcon={{
name: 'telegram',
type: 'font-awesome',
2020-03-31 20:16:22 +02:00
color: '#0088cc',
2020-03-31 20:10:49 +02:00
}}
onPress={handleOnTelegramPress}
2020-07-20 16:38:46 +03:00
title={loc.settings.about_sm_telegram}
2020-03-31 20:10:49 +02:00
/>
2020-09-21 21:53:28 -04:00
<BlueListItem
2020-03-31 20:10:49 +02:00
leftIcon={{
name: 'github',
type: 'font-awesome',
2020-07-15 13:32:59 -04:00
color: colors.foregroundColor,
2020-03-31 20:10:49 +02:00
}}
onPress={handleOnGithubPress}
2020-07-20 16:38:46 +03:00
title={loc.settings.about_sm_github}
2020-03-31 20:10:49 +02:00
/>
<BlueCard>
<View style={styles.buildWith}>
2020-03-31 20:16:22 +02:00
<BlueSpacing20 />
2019-12-25 10:46:51 -06:00
2020-07-20 16:38:46 +03:00
<BlueTextCentered>{loc.settings.about_awesome} 👍</BlueTextCentered>
2020-03-31 20:16:22 +02:00
<BlueSpacing20 />
<BlueTextCentered>React Native</BlueTextCentered>
<BlueTextCentered>bitcoinjs-lib</BlueTextCentered>
<BlueTextCentered>Nodejs</BlueTextCentered>
<BlueTextCentered>Electrum server</BlueTextCentered>
2020-03-31 20:10:49 +02:00
</View>
2019-12-25 10:46:51 -06:00
</BlueCard>
2020-09-21 21:53:28 -04:00
<BlueListItem
2020-03-31 20:10:49 +02:00
leftIcon={{
name: 'book',
type: 'font-awesome',
2020-03-31 20:16:22 +02:00
color: '#9AA0AA',
2020-03-31 20:10:49 +02:00
}}
2020-05-03 14:17:49 -04:00
chevron
2020-03-31 20:10:49 +02:00
onPress={handleOnReleaseNotesPress}
2020-07-20 16:38:46 +03:00
title={loc.settings.about_release_notes}
2020-03-31 20:10:49 +02:00
/>
2020-09-21 21:53:28 -04:00
<BlueListItem
2020-03-31 21:13:48 +02:00
leftIcon={{
name: 'law',
type: 'octicon',
2020-07-15 13:32:59 -04:00
color: colors.foregroundColor,
2020-03-31 21:13:48 +02:00
}}
2020-05-03 14:17:49 -04:00
chevron
2020-03-31 21:13:48 +02:00
onPress={handleOnLicensingPress}
title="MIT License"
/>
2020-09-21 21:53:28 -04:00
<BlueListItem
2020-03-31 20:10:49 +02:00
leftIcon={{
name: 'flask',
type: 'font-awesome',
2020-03-31 20:16:22 +02:00
color: '#FC0D44',
2020-03-31 20:10:49 +02:00
}}
2020-05-03 14:17:49 -04:00
chevron
2020-03-31 20:10:49 +02:00
onPress={handleOnSelfTestPress}
testID="RunSelfTestButton"
2020-07-20 16:38:46 +03:00
title={loc.settings.about_selftest}
2020-03-31 20:10:49 +02:00
/>
<BlueSpacing20 />
<BlueSpacing20 />
<BlueTextCentered>
{getApplicationName()} ver {getVersion()} (build {getBuildNumber()})
</BlueTextCentered>
<BlueTextCentered>{new Date(getBuildNumber() * 1000).toGMTString()}</BlueTextCentered>
<BlueTextCentered>{getBundleId()}</BlueTextCentered>
<BlueTextCentered>
w, h = {width}, {height}
</BlueTextCentered>
2020-03-31 20:32:34 +02:00
<BlueSpacing20 />
<BlueSpacing20 />
2019-12-25 10:46:51 -06:00
</ScrollView>
</SafeBlueArea>
);
2018-03-31 14:43:08 +01:00
};
2019-12-25 10:46:51 -06:00
About.navigationOptions = () => ({
...BlueNavigationStyle(),
2020-07-15 13:32:59 -04:00
headerTitle: loc.settings.about,
2019-12-25 10:46:51 -06:00
});
export default About;