Merge branch 'master' into Quorum-modal,-not-possible-to-go-back-#2069-

This commit is contained in:
marcosrdz 2020-11-11 19:03:30 -05:00
commit 96b3287140
9 changed files with 87 additions and 36 deletions

View File

@ -1646,7 +1646,13 @@ export const BlueTransactionListItem = React.memo(({ item, itemPriceUnit = Bitco
[colors.lightBorder],
);
const title = useMemo(() => transactionTimeToReadable(item.received), [item.received]);
const title = useMemo(() => {
if (item.confirmations === 0) {
return loc.transactions.pending;
} else {
return transactionTimeToReadable(item.received);
}
}, [item.confirmations, item.received]);
const txMemo = txMetadata[item.hash]?.memo ?? '';
const subtitle = useMemo(() => {
let sub = item.confirmations < 7 ? loc.formatString(loc.transactions.list_conf, { number: item.confirmations }) : '';

View File

@ -310,8 +310,9 @@
"details_title": "Transaction",
"details_to": "Output",
"details_transaction_details": "Transaction details",
"enable_hw": "This wallet is not being used in conjunction with a hardwarde wallet. Would you like to enable hardware wallet use?",
"enable_hw": "This wallet is not being used in conjunction with a hardware wallet. Would you like to enable hardware wallet use?",
"list_conf": "conf: {number}",
"pending": "Pending",
"list_title": "transactions",
"rbf_explain": "We will replace this transaction with the one with a higher fee, so it should be mined faster. This is called RBF - Replace By Fee.",
"rbf_title": "Bump fee (RBF)",

View File

@ -1,5 +1,15 @@
import React, { useState, useRef, useEffect, useContext } from 'react';
import { Keyboard, KeyboardAvoidingView, Platform, StatusBar, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import {
Keyboard,
KeyboardAvoidingView,
Platform,
StatusBar,
StyleSheet,
Text,
TouchableOpacity,
useWindowDimensions,
View,
} from 'react-native';
import LottieView from 'lottie-react-native';
import { Icon } from 'react-native-elements';
import { BlueButton, BlueListItem, BlueNavigationStyle, BlueSpacing20 } from '../../BlueComponents';
@ -21,6 +31,8 @@ const WalletsAddMultisig = () => {
const [format, setFormat] = useState(MultisigHDWallet.FORMAT_P2WSH);
const { isAdancedModeEnabled } = useContext(BlueStorageContext);
const [isAdvancedModeEnabledRender, setIsAdvancedModeEnabledRender] = useState(false);
const windowHeight = useWindowDimensions().height;
const windowWidth = useWindowDimensions().width;
const stylesHook = StyleSheet.create({
root: {
@ -99,7 +111,14 @@ const WalletsAddMultisig = () => {
const renderModal = () => {
return (
<Modal isVisible={isModalVisible} style={styles.bottomModal} onBackdropPress={closeModal} onBackButtonPress={closeModal}>
<Modal
isVisible={isModalVisible}
style={styles.bottomModal}
deviceHeight={windowHeight}
deviceWidth={windowWidth}
onBackdropPress={closeModal}
onBackButtonPress={closeModal}
>
<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'position' : null}>
<View style={[styles.modalContentShort, stylesHook.modalContentShort]}>
<Text style={[styles.textHeader, stylesHook.textHeader]}>{loc.multisig.quorum_header}</Text>

View File

@ -11,6 +11,7 @@ import {
StyleSheet,
Text,
TouchableOpacity,
useWindowDimensions,
View,
} from 'react-native';
import {
@ -53,6 +54,8 @@ const staticCache = {};
const WalletsAddMultisigStep2 = () => {
const { addWallet, saveToDisk, setNewWalletAdded } = useContext(BlueStorageContext);
const { colors } = useTheme();
const windowHeight = useWindowDimensions().height;
const windowWidth = useWindowDimensions().width;
const navigation = useNavigation();
const { m, n, format } = useRoute().params;
@ -501,6 +504,8 @@ const WalletsAddMultisigStep2 = () => {
isVisible={isMnemonicsModalVisible}
style={styles.bottomModal}
onBackButtonPress={Keyboard.dismiss}
deviceHeight={windowHeight}
deviceWidth={windowWidth}
onBackdropPress={Keyboard.dismiss}
>
<View style={[styles.newKeyModalContent, stylesHook.modalContent]}>
@ -536,6 +541,8 @@ const WalletsAddMultisigStep2 = () => {
const renderProvideMnemonicsModal = () => {
return (
<Modal
deviceHeight={windowHeight}
deviceWidth={windowWidth}
isVisible={isProvideMnemonicsModalVisible}
style={styles.bottomModal}
onBackdropPress={hideProvideMnemonicsModal}
@ -572,6 +579,8 @@ const WalletsAddMultisigStep2 = () => {
const renderCosignersXpubModal = () => {
return (
<Modal
deviceHeight={windowHeight}
deviceWidth={windowWidth}
isVisible={isRenderCosignersXpubModalVisible}
style={styles.bottomModal}
onBackdropPress={hideCosignersXpubModal}
@ -630,7 +639,7 @@ const WalletsAddMultisigStep2 = () => {
const styles = StyleSheet.create({
root: {
flex: 1,
marginHorizontal: 20,
paddingHorizontal: 20,
},
mainBlock: {
height: '100%',

View File

@ -475,7 +475,7 @@ const WalletDetails = () => {
<BlueSpacing20 />
<BlueSpacing20 />
<TouchableOpacity onPress={handleDeleteButtonTapped}>
<Text style={styles.delete}>{loc.wallets.details_delete}</Text>
<Text textBreakStrategy="simple" style={styles.delete}>{`${loc.wallets.details_delete}${' '}`}</Text>
</TouchableOpacity>
</View>
</BlueCard>

View File

@ -193,7 +193,9 @@ const WalletsList = () => {
const style = { opacity: isLoading ? 1.0 : 0.5 };
return (
<View style={[styles.listHeaderBack, stylesHook.listHeaderBack]}>
<Text style={[styles.listHeaderText, stylesHook.listHeaderText]}>{loc.transactions.list_title}</Text>
<Text textBreakStrategy="simple" style={[styles.listHeaderText, stylesHook.listHeaderText]}>
{`${loc.transactions.list_title}${' '}`}
</Text>
{isDesktop && (
<TouchableOpacity style={style} onPress={refreshTransactions} disabled={isLoading}>
<Icon name="refresh" type="font-awesome" color={colors.feeText} />

View File

@ -117,7 +117,19 @@ Coin.propTypes = {
const Dice = ({ push, sides }) => {
const { width } = useWindowDimensions();
const { colors } = useTheme();
const diceWidth = width / 4;
const stylesHook = StyleSheet.create({
dice: {
borderColor: colors.buttonBackgroundColor,
},
diceText: {
color: colors.foregroundColor,
},
diceContainer: {
backgroundColor: colors.elevated,
},
});
const diceIcon = i => {
switch (i) {
case 1:
@ -136,15 +148,15 @@ const Dice = ({ push, sides }) => {
};
return (
<ScrollView contentContainerStyle={styles.diceContainer}>
<ScrollView contentContainerStyle={[styles.diceContainer, stylesHook.diceContainer]}>
{[...Array(sides)].map((_, i) => (
<TouchableOpacity key={i} onPress={() => push(getEntropy(i, sides))}>
<View style={[styles.diceRoot, { width: diceWidth }]}>
{sides === 6 ? (
<Icon style={styles.diceIcon} name={diceIcon(i + 1)} size={70} color="grey" type="font-awesome-5" />
) : (
<View style={styles.dice}>
<Text style={styles.diceText}>{i + 1}</Text>
<View style={[styles.dice, stylesHook.dice]}>
<Text style={stylesHook.diceText}>{i + 1}</Text>
</View>
)}
</View>
@ -164,13 +176,13 @@ const buttonFontSize =
? 22
: PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26);
const Buttons = ({ pop, save }) => (
const Buttons = ({ pop, save, colors }) => (
<FContainer>
<FButton
onPress={pop}
icon={
<View style={styles.buttonsIcon}>
<Icon name="undo" size={buttonFontSize} type="font-awesome" color={BlueCurrentTheme.colors.buttonAlternativeTextColor} />
<Icon name="undo" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
</View>
}
text={loc.entropy.undo}
@ -179,7 +191,7 @@ const Buttons = ({ pop, save }) => (
onPress={save}
icon={
<View style={styles.buttonsIcon}>
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={BlueCurrentTheme.colors.buttonAlternativeTextColor} />
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
</View>
}
text={loc.entropy.save}
@ -190,6 +202,7 @@ const Buttons = ({ pop, save }) => (
Buttons.propTypes = {
pop: PropTypes.func.isRequired,
save: PropTypes.func.isRequired,
colors: PropTypes.shape.isRequired,
};
const Entropy = () => {
@ -199,6 +212,17 @@ const Entropy = () => {
const [tab, setTab] = useState(1);
const [show, setShow] = useState(false);
const { colors } = useTheme();
const stylesHook = StyleSheet.create({
entropy: {
backgroundColor: colors.inputBackgroundColor,
},
entropyText: {
color: colors.foregroundColor,
},
coinBody: {
borderColor: colors.lightButton,
},
});
const push = v => v && dispatch({ type: 'push', value: v.value, bits: v.bits });
const pop = () => dispatch({ type: 'pop' });
@ -216,8 +240,8 @@ const Entropy = () => {
<SafeBlueArea>
<BlueSpacing20 />
<TouchableOpacity onPress={() => setShow(!show)}>
<View style={styles.entropy}>
<Text style={styles.entropyText}>{show ? hex : `${bits} of 256 bits`}</Text>
<View style={[styles.entropy, stylesHook.entropy]}>
<Text style={[styles.entropyText, stylesHook.entropyText]}>{show ? hex : `${bits} of 256 bits`}</Text>
</View>
</TouchableOpacity>
@ -241,7 +265,7 @@ const Entropy = () => {
{tab === 1 && <Dice sides={6} push={push} />}
{tab === 2 && <Dice sides={20} push={push} />}
<Buttons pop={pop} save={save} />
<Buttons pop={pop} save={save} colors={colors} />
</SafeBlueArea>
);
};
@ -263,7 +287,6 @@ const styles = StyleSheet.create({
padding: 5,
marginLeft: 10,
marginRight: 10,
backgroundColor: BlueCurrentTheme.colors.inputBackgroundColor,
borderRadius: 9,
minHeight: 49,
paddingHorizontal: 8,
@ -274,7 +297,6 @@ const styles = StyleSheet.create({
entropyText: {
fontSize: 15,
fontFamily: 'Courier',
color: BlueCurrentTheme.colors.foregroundColor,
},
coinRoot: {
flex: 1,
@ -322,9 +344,6 @@ const styles = StyleSheet.create({
aspectRatio: 1,
borderColor: BlueCurrentTheme.colors.buttonBackgroundColor,
},
diceText: {
color: BlueCurrentTheme.colors.foregroundColor,
},
diceIcon: {
margin: 3,
justifyContent: 'center',

View File

@ -31,7 +31,6 @@ import HandoffSettings from '../../class/handoff';
import Handoff from 'react-native-handoff';
import ActionSheet from '../ActionSheet';
import loc from '../../loc';
import { BlueCurrentTheme } from '../../components/themes';
import { FContainer, FButton } from '../../components/FloatButtons';
import { getSystemName } from 'react-native-device-info';
import { useRoute, useNavigation, useTheme, useFocusEffect } from '@react-navigation/native';
@ -648,12 +647,7 @@ const WalletTransactions = () => {
}}
icon={
<View style={styles.receiveIcon}>
<Icon
name="arrow-down"
size={buttonFontSize}
type="font-awesome"
color={BlueCurrentTheme.colors.buttonAlternativeTextColor}
/>
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
</View>
}
/>
@ -667,12 +661,7 @@ const WalletTransactions = () => {
testID="SendButton"
icon={
<View style={styles.sendIcon}>
<Icon
name="arrow-down"
size={buttonFontSize}
type="font-awesome"
color={BlueCurrentTheme.colors.buttonAlternativeTextColor}
/>
<Icon name="arrow-down" size={buttonFontSize} type="font-awesome" color={colors.buttonAlternativeTextColor} />
</View>
}
/>

View File

@ -54,6 +54,7 @@ const ViewEditMultisigCosigners = () => {
const tempWallet = useRef(new MultisigHDWallet());
const [wallet, setWallet] = useState();
const [isLoading, setIsLoading] = useState(true);
const [isSaveButtonDisabled, setIsSaveButtonDisabled] = useState(true);
const [currentlyEditingCosignerNum, setCurrentlyEditingCosignerNum] = useState(false);
const [isProvideMnemonicsModalVisible, setIsProvideMnemonicsModalVisible] = useState(false);
const [isMnemonicsModalVisible, setIsMnemonicsModalVisible] = useState(false);
@ -117,12 +118,13 @@ const ViewEditMultisigCosigners = () => {
},
});
const onSave = () => {
const onSave = async () => {
setIsLoading(true);
// eslint-disable-next-line prefer-const
let newWallets = wallets.filter(w => {
return w.getID() !== walletId;
});
await wallet.fetchBalance();
newWallets.push(wallet);
setWalletsWithNewOrder(newWallets);
goBack();
@ -355,6 +357,7 @@ const ViewEditMultisigCosigners = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setWallet(wallet);
setIsProvideMnemonicsModalVisible(false);
setIsSaveButtonDisabled(false);
};
const xpubInsteadOfSeed = index => {
@ -369,6 +372,7 @@ const ViewEditMultisigCosigners = () => {
wallet.addCosigner(xpub, newFp, path);
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setWallet(wallet);
setIsSaveButtonDisabled(false);
resolve();
} catch (e) {
alert(e.message);
@ -460,7 +464,9 @@ const ViewEditMultisigCosigners = () => {
</SafeAreaView>
);
const footer = <BlueButtonHook disabled={vaultKeyData.isLoading || isLoading} title={loc._.save} onPress={onSave} />;
const footer = (
<BlueButtonHook disabled={vaultKeyData.isLoading || isSaveButtonDisabled} title={loc._.save} onPress={onSave} />
);
return (
<SafeAreaView style={[styles.root, stylesHook.root]}>