FIX: better android support

This commit is contained in:
Overtorment 2018-11-09 23:44:34 +00:00
parent c7cfe200a1
commit 0f6f3d69ca
7 changed files with 77 additions and 31 deletions

View file

@ -3,7 +3,7 @@ import React, { Component } from 'react';
import Ionicons from 'react-native-vector-icons/Ionicons'; import Ionicons from 'react-native-vector-icons/Ionicons';
import { LinearGradient, Constants } from 'expo'; import { LinearGradient, Constants } from 'expo';
import { Icon, Button, FormLabel, FormInput, Text, Header, List, ListItem } from 'react-native-elements'; import { Icon, Button, FormLabel, FormInput, Text, Header, List, ListItem } from 'react-native-elements';
import { TouchableOpacity, ActivityIndicator, View, StyleSheet, Dimensions, Image, SafeAreaView, Clipboard } from 'react-native'; import { TouchableOpacity, ActivityIndicator, View, StyleSheet, Dimensions, Image, SafeAreaView, Clipboard, Platform } from 'react-native';
import { WatchOnlyWallet, LegacyWallet } from './class'; import { WatchOnlyWallet, LegacyWallet } from './class';
import Carousel from 'react-native-snap-carousel'; import Carousel from 'react-native-snap-carousel';
import { HDLegacyP2PKHWallet } from './class/hd-legacy-p2pkh-wallet'; import { HDLegacyP2PKHWallet } from './class/hd-legacy-p2pkh-wallet';
@ -157,8 +157,8 @@ export const BlueNavigationStyle = (navigation, withNavigationCloseButton = fals
}, },
headerTintColor: '#0c2550', headerTintColor: '#0c2550',
headerRight: withNavigationCloseButton ? ( headerRight: withNavigationCloseButton ? (
<TouchableOpacity style={{ marginHorizontal: 16 }} onPress={() => navigation.goBack(null)}> <TouchableOpacity style={{ width: 40, height: 40, padding: 14 }} onPress={() => navigation.goBack(null)}>
<Image source={require('./img/close.png')} /> <Image style={{ alignSelf: 'center' }} source={require('./img/close.png')} />
</TouchableOpacity> </TouchableOpacity>
) : null, ) : null,
headerBackTitle: null, headerBackTitle: null,
@ -446,6 +446,9 @@ export class is {
} }
static iphone8() { static iphone8() {
if (Platform.OS !== 'ios') {
return false;
}
return Constants.platform.ios.platform === 'iPhone10,4'; return Constants.platform.ios.platform === 'iPhone10,4';
} }
} }
@ -849,9 +852,12 @@ export class NewWalletPannel extends Component {
this.handleClick(); this.handleClick();
} }
}} }}
style={{ marginVertical: 17 }}
> >
<LinearGradient <LinearGradient
colors={['#eef0f4', '#eef0f4']} colors={['#eef0f4', '#eef0f4']}
start={[0, 0]}
end={[1, 1]}
style={{ style={{
padding: 15, padding: 15,
borderRadius: 10, borderRadius: 10,
@ -956,7 +962,7 @@ export class WalletsCarousel extends Component {
} }
return ( return (
<View style={{ paddingRight: 10 }}> <View style={{ paddingRight: 10, marginVertical: 17 }}>
<TouchableOpacity <TouchableOpacity
activeOpacity={1} activeOpacity={1}
onPress={() => { onPress={() => {
@ -966,12 +972,19 @@ export class WalletsCarousel extends Component {
}} }}
> >
<LinearGradient <LinearGradient
shadowOpacity={18 / 100} shadowOpacity={20 / 100}
shadowOffset={{ width: 0, height: 4 }} shadowOffset={{ width: 0, height: 4 }}
shadowRadius={10} shadowRadius={10}
shadowColor="#000000" shadowColor="#000000"
colors={[gradient1, gradient2]} colors={[gradient1, gradient2]}
style={{ padding: 15, borderRadius: 10, height: 164 }} style={{
padding: 15,
borderRadius: 10,
height: 164,
elevation: 5,
}}
start={[0, 0]}
end={[1, 1]}
> >
<Image <Image
source={ source={

View file

@ -1,5 +1,5 @@
import { AppStorage } from './class'; import { AppStorage } from './class';
import Expo from 'expo'; import { Accelerometer } from 'expo';
import { AsyncStorage } from 'react-native'; import { AsyncStorage } from 'react-native';
const bitcoin = require('bitcoinjs-lib'); const bitcoin = require('bitcoinjs-lib');
const REQUIRE_NUM_CHUNKS = 16; const REQUIRE_NUM_CHUNKS = 16;
@ -31,7 +31,7 @@ let listener = function(accelerometerData) {
if (chunks.length >= REQUIRE_NUM_CHUNKS) { if (chunks.length >= REQUIRE_NUM_CHUNKS) {
console.log('got enough entropy, saving to storage'); console.log('got enough entropy, saving to storage');
Expo.Accelerometer.removeAllListeners(); Accelerometer.removeAllListeners();
runningListeners--; runningListeners--;
AsyncStorage.setItem(AppStorage.ENTROPY, JSON.stringify(chunks)); AsyncStorage.setItem(AppStorage.ENTROPY, JSON.stringify(chunks));
} }
@ -50,7 +50,7 @@ async function start() {
setInterval(() => { setInterval(() => {
if (chunks.length < REQUIRE_NUM_CHUNKS && runningListeners === 0) { if (chunks.length < REQUIRE_NUM_CHUNKS && runningListeners === 0) {
console.log('not enough entropy, starting listener to gather'); console.log('not enough entropy, starting listener to gather');
Expo.Accelerometer.addListener(listener); Accelerometer.addListener(listener);
runningListeners++; runningListeners++;
} }
}, 1000); }, 1000);

28
package-lock.json generated
View file

@ -5845,11 +5845,13 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true "bundled": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -5862,15 +5864,18 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true "bundled": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -5973,7 +5978,8 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true "bundled": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -5983,6 +5989,7 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -5995,17 +6002,20 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true "bundled": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -6022,6 +6032,7 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -6094,7 +6105,8 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true "bundled": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -6104,6 +6116,7 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -6209,6 +6222,7 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",

View file

@ -481,7 +481,6 @@ export default class SendDetails extends Component {
<Text style={{ color: '#FFFFFF' }}>{loc.send.details.scan}</Text> <Text style={{ color: '#FFFFFF' }}>{loc.send.details.scan}</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
)}
<View <View
hide={!this.state.showMemoRow} hide={!this.state.showMemoRow}
style={{ style={{
@ -508,7 +507,6 @@ export default class SendDetails extends Component {
editable={!this.state.isLoading} editable={!this.state.isLoading}
/> />
</View> </View>
)}
<TouchableOpacity <TouchableOpacity
onPress={() => this.setState({ isFeeSelectionModalVisible: true })} onPress={() => this.setState({ isFeeSelectionModalVisible: true })}
disabled={this.state.isLoading} disabled={this.state.isLoading}
@ -531,7 +529,6 @@ export default class SendDetails extends Component {
<Text style={{ color: '#37c0a1', paddingRight: 4, textAlign: 'left' }}>sat/b</Text> <Text style={{ color: '#37c0a1', paddingRight: 4, textAlign: 'left' }}>sat/b</Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
)}
{this.renderCreateButton()} {this.renderCreateButton()}
{this.renderFeeSelectionModal()} {this.renderFeeSelectionModal()}
</KeyboardAvoidingView> </KeyboardAvoidingView>

View file

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Constants } from 'expo'; import { Constants } from 'expo';
import { ScrollView, Linking, Dimensions } from 'react-native'; import { ScrollView, Linking, Dimensions, Platform } from 'react-native';
import { import {
BlueTextCentered, BlueTextCentered,
BlueLoading, BlueLoading,
@ -38,6 +38,26 @@ export default class About extends Component {
}); });
} }
platformSpecificInformation() {
if (Platform.OS === 'android') {
return (
<React.Fragment>
<BlueTextCentered>Version code: {Constants.platform.android.versionCode}</BlueTextCentered>
<BlueSpacing20 />
</React.Fragment>
);
} else if (Platform.OS === 'ios') {
return (
<React.Fragment>
<BlueTextCentered>
{Constants.platform.ios.model} ({Constants.platform.ios.platform})
</BlueTextCentered>
<BlueSpacing20 />
</React.Fragment>
);
}
}
render() { render() {
if (this.state.isLoading) { if (this.state.isLoading) {
return <BlueLoading />; return <BlueLoading />;
@ -113,11 +133,7 @@ export default class About extends Component {
<BlueTextCentered> <BlueTextCentered>
w, h = {width}, {height} w, h = {width}, {height}
</BlueTextCentered> </BlueTextCentered>
<BlueTextCentered> {this.platformSpecificInformation()}
{Constants.platform.ios.model} ({Constants.platform.ios.platform})
</BlueTextCentered>
<BlueSpacing20 />
<BlueTextCentered> <BlueTextCentered>
{pkg.name} v{pkg.version} (build {appjson.expo.ios.buildNumber}) {pkg.name} v{pkg.version} (build {appjson.expo.ios.buildNumber})
</BlueTextCentered> </BlueTextCentered>

View file

@ -1,6 +1,6 @@
/* global alert */ /* global alert */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { ActivityIndicator, View, Button, Text, TextInput, Alert, TouchableOpacity } from 'react-native'; import { ActivityIndicator, View, Text, TextInput, Alert, TouchableOpacity } from 'react-native';
import { BlueButton, SafeBlueArea, BlueCard, BlueSpacing20, BlueNavigationStyle } from '../../BlueComponents'; import { BlueButton, SafeBlueArea, BlueCard, BlueSpacing20, BlueNavigationStyle } from '../../BlueComponents';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { LightningCustodianWallet } from '../../class/lightning-custodian-wallet'; import { LightningCustodianWallet } from '../../class/lightning-custodian-wallet';
@ -14,13 +14,14 @@ export default class WalletDetails extends Component {
...BlueNavigationStyle(), ...BlueNavigationStyle(),
title: loc.wallets.details.title, title: loc.wallets.details.title,
headerRight: ( headerRight: (
<Button <TouchableOpacity
color="#0c2550" style={{ marginHorizontal: 16 }}
title={loc.wallets.details.save}
onPress={() => { onPress={() => {
navigation.getParam('saveAction')(); navigation.getParam('saveAction')();
}} }}
/> >
<Text style={{ color: '#0c2550' }}>{loc.wallets.details.save}</Text>
</TouchableOpacity>
), ),
}); });

View file

@ -215,7 +215,12 @@ export default class WalletTransactions extends Component {
renderWalletHeader = () => { renderWalletHeader = () => {
return ( return (
<LinearGradient colors={[this.state.gradientColors[0], this.state.gradientColors[1]]} style={{ padding: 15, height: 164 }}> <LinearGradient
start={[0, 0]}
end={[1, 1]}
colors={[this.state.gradientColors[0], this.state.gradientColors[1]]}
style={{ padding: 15, height: 164 }}
>
<Image <Image
source={ source={
(new LightningCustodianWallet().type === this.state.wallet.type && require('../../img/lnd-shape.png')) || (new LightningCustodianWallet().type === this.state.wallet.type && require('../../img/lnd-shape.png')) ||