mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
Update ViewEditMultisigCosigners.tsx
This commit is contained in:
parent
eb139c5320
commit
3f83423e7e
@ -92,9 +92,6 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||||||
textDestination: {
|
textDestination: {
|
||||||
color: colors.foregroundColor,
|
color: colors.foregroundColor,
|
||||||
},
|
},
|
||||||
modalContent: {
|
|
||||||
backgroundColor: colors.elevated,
|
|
||||||
},
|
|
||||||
exportButton: {
|
exportButton: {
|
||||||
backgroundColor: colors.buttonDisabledBackgroundColor,
|
backgroundColor: colors.buttonDisabledBackgroundColor,
|
||||||
},
|
},
|
||||||
@ -224,65 +221,60 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||||||
}, [walletID]),
|
}, [walletID]),
|
||||||
);
|
);
|
||||||
|
|
||||||
const hideMnemonicsModal = () => {
|
|
||||||
Keyboard.dismiss();
|
|
||||||
mnemonicsModalRef.current?.dismiss();
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderMnemonicsModal = () => {
|
const renderMnemonicsModal = () => {
|
||||||
return (
|
return (
|
||||||
<BottomModal ref={mnemonicsModalRef} onClose={hideMnemonicsModal}>
|
<BottomModal
|
||||||
<View style={[styles.newKeyModalContent, stylesHook.modalContent]}>
|
ref={mnemonicsModalRef}
|
||||||
<View style={styles.itemKeyUnprovidedWrapper}>
|
footerDefaultMargins
|
||||||
<View style={[styles.vaultKeyCircleSuccess, stylesHook.vaultKeyCircleSuccess]}>
|
backgroundColor={colors.elevated}
|
||||||
<Icon size={24} name="check" type="ionicons" color={colors.msSuccessCheck} />
|
contentContainerStyle={styles.newKeyModalContent}
|
||||||
</View>
|
footer={
|
||||||
<View style={styles.vaultKeyTextWrapper}>
|
|
||||||
<Text style={[styles.vaultKeyText, stylesHook.vaultKeyText]}>
|
|
||||||
{loc.formatString(loc.multisig.vault_key, { number: vaultKeyData.keyIndex })}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<BlueSpacing20 />
|
|
||||||
{vaultKeyData.xpub.length > 1 && (
|
|
||||||
<>
|
|
||||||
<Text style={[styles.textDestination, stylesHook.textDestination]}>{loc._.wallet_key}</Text>
|
|
||||||
<BlueSpacing10 />
|
|
||||||
<SquareEnumeratedWords
|
|
||||||
contentAlign={SquareEnumeratedWordsContentAlign.left}
|
|
||||||
entries={[vaultKeyData.xpub, vaultKeyData.fp, vaultKeyData.path]}
|
|
||||||
appendNumber={false}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{vaultKeyData.seed.length > 1 && (
|
|
||||||
<>
|
|
||||||
<BlueSpacing20 />
|
|
||||||
<Text style={[styles.textDestination, stylesHook.textDestination]}>{loc._.seed}</Text>
|
|
||||||
<BlueSpacing10 />
|
|
||||||
<SquareEnumeratedWords
|
|
||||||
contentAlign={SquareEnumeratedWordsContentAlign.left}
|
|
||||||
entries={vaultKeyData.seed.split(' ')}
|
|
||||||
appendNumber
|
|
||||||
/>
|
|
||||||
{vaultKeyData.passphrase.length > 1 && (
|
|
||||||
<Text style={[styles.textDestination, stylesHook.textDestination]}>{vaultKeyData.passphrase}</Text>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<BlueSpacing20 />
|
|
||||||
<Button
|
<Button
|
||||||
title={loc.multisig.share}
|
title={loc.multisig.share}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
mnemonicsModalRef.current?.dismiss();
|
shareModalRef.current?.present();
|
||||||
setTimeout(() => {
|
|
||||||
shareModalRef.current?.present();
|
|
||||||
}, 1000);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<BlueSpacing20 />
|
}
|
||||||
<Button title={loc.send.success_done} onPress={() => mnemonicsModalRef.current?.dismiss()} />
|
>
|
||||||
|
<View style={styles.itemKeyUnprovidedWrapper}>
|
||||||
|
<View style={[styles.vaultKeyCircleSuccess, stylesHook.vaultKeyCircleSuccess]}>
|
||||||
|
<Icon size={24} name="check" type="ionicons" color={colors.msSuccessCheck} />
|
||||||
|
</View>
|
||||||
|
<View style={styles.vaultKeyTextWrapper}>
|
||||||
|
<Text style={[styles.vaultKeyText, stylesHook.vaultKeyText]}>
|
||||||
|
{loc.formatString(loc.multisig.vault_key, { number: vaultKeyData.keyIndex })}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
<BlueSpacing20 />
|
||||||
|
{vaultKeyData.xpub.length > 1 && (
|
||||||
|
<>
|
||||||
|
<Text style={[styles.textDestination, stylesHook.textDestination]}>{loc._.wallet_key}</Text>
|
||||||
|
<BlueSpacing10 />
|
||||||
|
<SquareEnumeratedWords
|
||||||
|
contentAlign={SquareEnumeratedWordsContentAlign.left}
|
||||||
|
entries={[vaultKeyData.xpub, vaultKeyData.fp, vaultKeyData.path]}
|
||||||
|
appendNumber={false}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{vaultKeyData.seed.length > 1 && (
|
||||||
|
<>
|
||||||
|
<BlueSpacing20 />
|
||||||
|
<Text style={[styles.textDestination, stylesHook.textDestination]}>{loc._.seed}</Text>
|
||||||
|
<BlueSpacing10 />
|
||||||
|
<SquareEnumeratedWords
|
||||||
|
contentAlign={SquareEnumeratedWordsContentAlign.left}
|
||||||
|
entries={vaultKeyData.seed.split(' ')}
|
||||||
|
appendNumber
|
||||||
|
/>
|
||||||
|
{vaultKeyData.passphrase.length > 1 && (
|
||||||
|
<Text style={[styles.textDestination, stylesHook.textDestination]}>{vaultKeyData.passphrase}</Text>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{renderShareModal()}
|
||||||
</BottomModal>
|
</BottomModal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -509,7 +501,6 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const scanOrOpenFile = async () => {
|
const scanOrOpenFile = async () => {
|
||||||
provideMnemonicsModalRef.current?.dismiss();
|
|
||||||
const scanned = await scanQrHelper(route.name, true);
|
const scanned = await scanQrHelper(route.name, true);
|
||||||
setImportText(String(scanned));
|
setImportText(String(scanned));
|
||||||
provideMnemonicsModalRef.current?.present();
|
provideMnemonicsModalRef.current?.present();
|
||||||
@ -522,57 +513,65 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||||||
setAskPassphrase(false);
|
setAskPassphrase(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const hideShareModal = () => {
|
const hideShareModal = () => {};
|
||||||
shareModalRef.current?.dismiss();
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderProvideMnemonicsModal = () => {
|
const renderProvideMnemonicsModal = () => {
|
||||||
return (
|
return (
|
||||||
<BottomModal onClose={hideProvideMnemonicsModal} ref={provideMnemonicsModalRef}>
|
<BottomModal
|
||||||
<View style={[styles.modalContent, stylesHook.modalContent]}>
|
onClose={hideProvideMnemonicsModal}
|
||||||
<BlueTextCentered>{loc.multisig.type_your_mnemonics}</BlueTextCentered>
|
ref={provideMnemonicsModalRef}
|
||||||
<BlueSpacing20 />
|
contentContainerStyle={styles.newKeyModalContent}
|
||||||
<BlueFormMultiInput value={importText} onChangeText={setImportText} />
|
backgroundColor={colors.elevated}
|
||||||
{isAdvancedModeEnabled && (
|
footerDefaultMargins
|
||||||
<>
|
footer={
|
||||||
<BlueSpacing10 />
|
<>
|
||||||
<View style={styles.row}>
|
{isLoading ? (
|
||||||
<BlueText>{loc.wallets.import_passphrase}</BlueText>
|
<ActivityIndicator />
|
||||||
<Switch testID="AskPassphrase" value={askPassphrase} onValueChange={setAskPassphrase} />
|
) : (
|
||||||
</View>
|
<Button disabled={importText.trim().length === 0} title={loc.wallets.import_do_import} onPress={handleUseMnemonicPhrase} />
|
||||||
</>
|
)}
|
||||||
)}
|
<BlueButtonLink ref={openScannerButtonRef} disabled={isLoading} onPress={scanOrOpenFile} title={loc.wallets.import_scan_qr} />
|
||||||
<BlueSpacing20 />
|
</>
|
||||||
{isLoading ? (
|
}
|
||||||
<ActivityIndicator />
|
>
|
||||||
) : (
|
<BlueTextCentered>{loc.multisig.type_your_mnemonics}</BlueTextCentered>
|
||||||
<Button disabled={importText.trim().length === 0} title={loc.wallets.import_do_import} onPress={handleUseMnemonicPhrase} />
|
<BlueSpacing20 />
|
||||||
)}
|
<BlueFormMultiInput value={importText} onChangeText={setImportText} />
|
||||||
<BlueButtonLink ref={openScannerButtonRef} disabled={isLoading} onPress={scanOrOpenFile} title={loc.wallets.import_scan_qr} />
|
{isAdvancedModeEnabled && (
|
||||||
</View>
|
<>
|
||||||
|
<BlueSpacing10 />
|
||||||
|
<View style={styles.row}>
|
||||||
|
<BlueText>{loc.wallets.import_passphrase}</BlueText>
|
||||||
|
<Switch testID="AskPassphrase" value={askPassphrase} onValueChange={setAskPassphrase} />
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</BottomModal>
|
</BottomModal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderShareModal = () => {
|
const renderShareModal = () => {
|
||||||
return (
|
return (
|
||||||
<BottomModal ref={shareModalRef} onClose={hideShareModal}>
|
<BottomModal
|
||||||
<View style={[styles.modalContent, stylesHook.modalContent, styles.alignItemsCenter]}>
|
ref={shareModalRef}
|
||||||
<Text style={[styles.headerText, stylesHook.textDestination]}>
|
onClose={hideShareModal}
|
||||||
{loc.multisig.this_is_cosigners_xpub} {Platform.OS === 'ios' ? loc.multisig.this_is_cosigners_xpub_airdrop : ''}
|
contentContainerStyle={[styles.modalContent, styles.alignItemsCenter]}
|
||||||
</Text>
|
backgroundColor={colors.elevated}
|
||||||
<QRCodeComponent value={exportStringURv2} size={260} isLogoRendered={false} />
|
>
|
||||||
<BlueSpacing20 />
|
<Text style={[styles.headerText, stylesHook.textDestination]}>
|
||||||
<View style={styles.squareButtonWrapper}>
|
{loc.multisig.this_is_cosigners_xpub} {Platform.OS === 'ios' ? loc.multisig.this_is_cosigners_xpub_airdrop : ''}
|
||||||
<SaveFileButton
|
</Text>
|
||||||
style={[styles.exportButton, stylesHook.exportButton]}
|
<QRCodeComponent value={exportStringURv2} size={260} isLogoRendered={false} />
|
||||||
fileContent={exportString}
|
<BlueSpacing20 />
|
||||||
fileName={exportFilename}
|
<View style={styles.squareButtonWrapper}>
|
||||||
afterOnPress={saveFileButtonAfterOnPress}
|
<SaveFileButton
|
||||||
>
|
style={[styles.exportButton, stylesHook.exportButton]}
|
||||||
<SquareButton title={loc.multisig.share} />
|
fileContent={exportString}
|
||||||
</SaveFileButton>
|
fileName={exportFilename}
|
||||||
</View>
|
afterOnPress={saveFileButtonAfterOnPress}
|
||||||
|
>
|
||||||
|
<SquareButton title={loc.multisig.share} />
|
||||||
|
</SaveFileButton>
|
||||||
</View>
|
</View>
|
||||||
</BottomModal>
|
</BottomModal>
|
||||||
);
|
);
|
||||||
@ -639,8 +638,6 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
|||||||
|
|
||||||
{renderProvideMnemonicsModal()}
|
{renderProvideMnemonicsModal()}
|
||||||
|
|
||||||
{renderShareModal()}
|
|
||||||
|
|
||||||
{renderMnemonicsModal()}
|
{renderMnemonicsModal()}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@ -657,20 +654,14 @@ const styles = StyleSheet.create({
|
|||||||
vaultKeyTextWrapper: { justifyContent: 'center', alignItems: 'center', paddingLeft: 16 },
|
vaultKeyTextWrapper: { justifyContent: 'center', alignItems: 'center', paddingLeft: 16 },
|
||||||
newKeyModalContent: {
|
newKeyModalContent: {
|
||||||
paddingHorizontal: 22,
|
paddingHorizontal: 22,
|
||||||
paddingVertical: 32,
|
paddingTop: 32,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
borderTopLeftRadius: 16,
|
minHeight: 300,
|
||||||
borderTopRightRadius: 16,
|
|
||||||
borderColor: 'rgba(0, 0, 0, 0.1)',
|
|
||||||
},
|
},
|
||||||
modalContent: {
|
modalContent: {
|
||||||
padding: 22,
|
padding: 22,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
borderTopLeftRadius: 16,
|
|
||||||
borderTopRightRadius: 16,
|
|
||||||
borderColor: 'rgba(0, 0, 0, 0.1)',
|
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
minHeight: 400,
|
|
||||||
},
|
},
|
||||||
vaultKeyCircleSuccess: {
|
vaultKeyCircleSuccess: {
|
||||||
width: 42,
|
width: 42,
|
||||||
|
Loading…
Reference in New Issue
Block a user