From fccd32c5c0dce757fbd40485b5848e662233f884 Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Thu, 13 Apr 2023 17:45:58 -0400 Subject: [PATCH] Satscard: add wait unlock for rate-limited cards --- locales/en.json | 1 + views/Settings/Satscard.tsx | 57 +++++++++++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/locales/en.json b/locales/en.json index 95c17839bb..1685846542 100644 --- a/locales/en.json +++ b/locales/en.json @@ -128,6 +128,7 @@ "views.Satscard.slotStatus": "Slot status", "views.Satscard.generateAddress": "Generate address", "views.Satscard.tapsignerNotSupported": "Tapsigner not supported", + "views.Satscard.wait": "Wait and unlock rate-limited card", "views.Settings.AddEditNode.certificateButton": "Certificate Install Instructions", "views.Settings.AddEditNode.nodeConfig": "Node Configuration", "views.Settings.AddEditNode.connectionStringClipboard": "Detected the following connection string in your clipboard", diff --git a/views/Settings/Satscard.tsx b/views/Settings/Satscard.tsx index 49c856c884..5522d931bc 100644 --- a/views/Settings/Satscard.tsx +++ b/views/Settings/Satscard.tsx @@ -44,6 +44,7 @@ interface SatscardState { selectedSlot: number; selectedSlotIndex: number; selectedSlotStatus: string; + rateLimited: boolean; } interface CardStatus { @@ -74,7 +75,8 @@ export default class Satscard extends React.Component< privkey: '', slotStatus: '', tapsignerError: false, - error: '' + error: '', + rateLimited: false }; } @@ -101,7 +103,8 @@ export default class Satscard extends React.Component< error, selectedSlot, selectedSlotIndex, - selectedSlotStatus + selectedSlotStatus, + rateLimited } = this.state; const BackButton = () => ( @@ -561,7 +564,55 @@ export default class Satscard extends React.Component< error: err.error || err.message || - err.toString() + err.toString(), + rateLimited: + err.toString() === + 'Error: 429 on dump: rate limited' + }); + } + + if (Platform.OS === 'android') { + await card.endNfcSession(); + ModalStore.toggleAndroidNfcModal(false); + } + }} + /> + + )} + {!cardStatus && rateLimited && ( + +