Skip to content

Commit

Permalink
fix: copy/paste working with seed & birthday
Browse files Browse the repository at this point in the history
  • Loading branch information
juanky201271 committed Oct 16, 2024
1 parent f05204a commit e042589
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"serversecondtry": "It doesn't seem to be a problem with the server. Someting else is happening.",
"alert-donation-title": "TIP ZINGOLABS",
"alert-donation-body": "Do you want to help ZingoLabs make Zcash more useful? Opt in to tip one Zenny (0.01 ZEC) to ZingoLabs with each transaction! If so, press confirm, otherwise press Cancel.",
"recoverseed": "Recover last Seed Phrase used in this device",
"recoverseed": "Recover last Seed Phrase used",
"recoverseedinstall": "Recovered the last Seed Phrase used in this device:",
"noservers": "None of the servers on the list are available, it is probably a connection error."
},
Expand Down
2 changes: 1 addition & 1 deletion app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"serversecondtry": "No parece haber ningún problema con el servidor. Ocurre algo diferente.",
"alert-donation-title": "APOYAR A ZINGOLABS",
"alert-donation-body": "¿Quieres ayudar a ZingoLabs a que Zcash sea más útil? Opta por dar una propina de un Zenny (0.01 ZEC) a ZingoLabs con cada transacción! Si es así, presione confirmar, de lo contrario presione Cancelar.",
"recoverseed": "Recuperar la última semilla usada en este dispositivo",
"recoverseed": "Recuperar la última semilla usada",
"recoverseedinstall": "Se recuperó la última semilla usada en este dispositivo:",
"noservers": "Ninguno de los servidores de la lista esta disponible, probablemente se trata de un error de conexion."
},
Expand Down
2 changes: 1 addition & 1 deletion app/translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"serversecondtry": "Não parece haver nenhum problema com o servidor. Algo mais está acontecendo.",
"alert-donation-title": "APOIAR A ZINGOLABS",
"alert-donation-body": "Você quer ajudar o ZingoLabs a tornar o Zcash mais útil? Opte por dar uma gorjeta de um Zenny (0.01 ZEC) para ZingoLabs em cada transação! Se sim, pressione confirmar, caso contrário, pressione Cancelar.",
"recoverseed": "Recuperar a última Frases de Recuperação usada neste dispositivo",
"recoverseed": "Recuperar a última Frases de Recuperação usada",
"recoverseedinstall": "Recuperou a última Frases de Recuperação usada neste dispositivo:",
"noservers": "Nenhum dos servidores da lista está disponível, provavelmente é um erro de conexão."
},
Expand Down
2 changes: 1 addition & 1 deletion app/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"serversecondtry": "Похоже, что с этим сервером нет никаких проблем. Проблема в чём-то другом.",
"alert-donation-title": "ПОДДЕРЖИВАЕМЫЕ ZINGOLABS",
"alert-donation-body": "Хотите помочь ZingoLabs сделать Zcash более полезным? Подпишитесь на чаевые в размере одного Zenny (0.01 ZEC) в пользу ZingoLabs за каждую транзакцию! Если да, нажмите «Подтвердить», в противном случае нажмите «Отмена».",
"recoverseed": "Восстановить последнюю исходную фразу, использованную на этом устройстве",
"recoverseed": "Восстановить последнюю использованную исходную фразу",
"noservers": "Ни один из серверов в списке недоступен, возможно, это ошибка подключения.",
"recoverseedinstall": "Восстановлена ​​последняя исходная фраза, использованная на этом устройстве:"
},
Expand Down
19 changes: 19 additions & 0 deletions components/Ufvk/ImportUfvk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,25 @@ const ImportUfvk: React.FunctionComponent<ImportUfvkProps> = ({ onClickCancel, o
}
}, [info.latestBlock, latestBlock, server]);

useEffect(() => {
if (seedufvkText) {
const seedufvkTextArray: string[] = seedufvkText.replaceAll('\n', ' ').replaceAll(' ', ' ').split(' ');
console.log(seedufvkTextArray);
// if the seed have 25 -> means it is a copy/paste from the stored seed in the device.
if (seedufvkTextArray.length === 25) {
// if the last word is a number -> move it to the birthday field
const lastWord: string = seedufvkTextArray[seedufvkTextArray.length - 1];
const possibleBirthday: number | null = isNaN(Number(lastWord)) ? null : Number(lastWord);
if (possibleBirthday && !birthday) {
setBirthday(possibleBirthday.toString());
setSeedufvkText(seedufvkTextArray.slice(0, 23).join(' '));
}
}
}
// only if seedufvk changed.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [seedufvkText]);

const okButton = async () => {
if (!netInfo.isConnected) {
addLastSnackbar({ message: translate('loadedapp.connection-error') as string });
Expand Down

0 comments on commit e042589

Please sign in to comment.