()
| 43 | const AnimatedFlatList = Animated.createAnimatedComponent(FlatList); |
| 44 | |
| 45 | const WalletsAddMultisigStep2 = () => { |
| 46 | const { addAndSaveWallet, sleep, currentSharedCosigner, setSharedCosigner } = useStorage(); |
| 47 | const { enableScreenProtect, disableScreenProtect } = useScreenProtect(); |
| 48 | const { colors } = useTheme(); |
| 49 | |
| 50 | const navigation = useExtendedNavigation(); |
| 51 | const route = useRoute<RouteProp<{ WalletsAddMultisigStep2: MultisigStep2Params }, 'WalletsAddMultisigStep2'>>(); |
| 52 | const params = route.params; |
| 53 | const { m, n, format, walletLabel } = params; |
| 54 | const [cosigners, setCosigners] = useState<CosignerTuple[]>([]); // array of cosigners user provided. if format [cosigner, fp, path] |
| 55 | const [isLoading, setIsLoading] = useState(false); |
| 56 | const [vaultKeyData, setVaultKeyData] = useState({ keyIndex: 1, xpub: '', seed: '', isLoading: false }); // string rendered in modal |
| 57 | const [importText, setImportText] = useState(''); |
| 58 | const [askPassphrase, setAskPassphrase] = useState(false); |
| 59 | const { isPrivacyBlurEnabled, isElectrumDisabled } = useSettings(); |
| 60 | const data = useRef(new Array(n).fill(null)); |
| 61 | |
| 62 | useFocusEffect( |
| 63 | useCallback(() => { |
| 64 | if (isPrivacyBlurEnabled) { |
| 65 | enableScreenProtect(); |
| 66 | } |
| 67 | return () => { |
| 68 | disableScreenProtect(); |
| 69 | }; |
| 70 | }, [isPrivacyBlurEnabled, enableScreenProtect, disableScreenProtect]), |
| 71 | ); |
| 72 | |
| 73 | useEffect(() => { |
| 74 | console.log(currentSharedCosigner); |
| 75 | if (currentSharedCosigner) { |
| 76 | (async function () { |
| 77 | if (await confirm(loc.multisig.shared_key_detected, loc.multisig.shared_key_detected_question)) { |
| 78 | setImportText(currentSharedCosigner); |
| 79 | navigation.navigate('WalletsAddMultisigProvideMnemonicsSheet', { |
| 80 | importText: currentSharedCosigner, |
| 81 | askPassphrase, |
| 82 | }); |
| 83 | setSharedCosigner(''); |
| 84 | } |
| 85 | })(); |
| 86 | } |
| 87 | // eslint-disable-next-line react-hooks/exhaustive-deps |
| 88 | }, [currentSharedCosigner]); |
| 89 | |
| 90 | const handleOnHelpPress = useCallback(() => { |
| 91 | navigation.navigate('WalletsAddMultisigHelp'); |
| 92 | }, [navigation]); |
| 93 | |
| 94 | const stylesHook = StyleSheet.create({ |
| 95 | root: { |
| 96 | backgroundColor: colors.elevated, |
| 97 | }, |
| 98 | }); |
| 99 | |
| 100 | useLayoutEffect(() => { |
| 101 | navigation.setOptions({ |
| 102 | // eslint-disable-next-line react/no-unstable-nested-components |
nothing calls this directly
no test coverage detected