@bsv/expo-wallet-toolbox 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +121 -30
- package/README.md +79 -79
- package/core/backup/RemoteSyncReader.ts +26 -24
- package/core/backup/appData.ts +9 -8
- package/core/backup/codec.ts +21 -18
- package/core/backup/constants.ts +5 -5
- package/core/backup/contactsBackup.ts +8 -8
- package/core/backup/cursor.ts +12 -7
- package/core/backup/derive.ts +3 -3
- package/core/backup/deviceId.ts +2 -2
- package/core/backup/erase.ts +2 -2
- package/core/backup/preference.ts +2 -2
- package/core/backup/push.ts +10 -12
- package/core/backup/restore.ts +22 -14
- package/core/backup/restoreOnImport.ts +3 -2
- package/core/config.tsx +17 -13
- package/core/constants.ts +34 -11
- package/core/contacts/contactsStore.ts +4 -3
- package/core/context/WalletConnectionContext.tsx +294 -212
- package/core/context/WalletContext.tsx +132 -97
- package/core/context/defaultWalletSettings.ts +4 -2
- package/core/demo/demoLedger.ts +1 -5
- package/core/directpay/DirectPayProvider.tsx +15 -24
- package/core/directpay/receive.ts +2 -1
- package/core/headers/checkpoints.ts +10 -1
- package/core/headers/headerStore.ts +13 -2
- package/core/hooks/useConfirmationSound.ts +3 -3
- package/core/hooks/useHaptics.ts +23 -6
- package/core/i18n/translations.tsx +269 -125
- package/core/index.ts +2 -0
- package/core/localpay/codec.ts +12 -6
- package/core/localpay/deviceCaps.ts +4 -14
- package/core/localpay/pending.ts +2 -1
- package/core/localpay/qr.ts +1 -1
- package/core/localpay/settlementAck.ts +1 -4
- package/core/localpay/transport/ble.ts +2 -2
- package/core/localpay/transport/socket.ts +1 -1
- package/core/mandala/abortGuard.ts +1 -1
- package/core/mandala/drain.ts +3 -0
- package/core/mandala/permissionModule.ts +3 -2
- package/core/mandala/resendTransfer.ts +4 -1
- package/core/mandala/runtime.ts +4 -4
- package/core/monitor/TaskBackupPush.ts +10 -13
- package/core/net/chainMatch.ts +8 -5
- package/core/networks.ts +145 -0
- package/core/parsePeerPayURI.ts +4 -1
- package/core/pay/beefRepair.ts +6 -3
- package/core/pay/creditErrors.ts +37 -1
- package/core/pay/rails/address.ts +10 -6
- package/core/pay/rails/handle.ts +84 -11
- package/core/pay/rails/index.ts +18 -2
- package/core/pay/receiveHistory.ts +8 -8
- package/core/peerpay/handleResendRequests.ts +11 -18
- package/core/peerpay/inboxAttempts.ts +1 -4
- package/core/peerpay/rebuildToken.ts +12 -9
- package/core/profiles/profileStore.ts +2 -1
- package/core/profiles/removalProblems.ts +3 -1
- package/core/services/arcTokenStorage.ts +2 -1
- package/core/services/arcadeBroadcastProvider.ts +7 -17
- package/core/services/secrets/envelope.ts +1 -6
- package/core/services/secrets/hkdf.ts +1 -6
- package/core/services/secrets/index.ts +3 -22
- package/core/services/usdFxRates.ts +1 -4
- package/core/services/vault/VaultKeyService.ts +2 -1
- package/core/services/vault/chainRecovery.ts +48 -21
- package/core/services/vault/metaAuthority.ts +4 -1
- package/core/services/vault/r1comb.ts +113 -51
- package/core/services/vault/session.ts +5 -1
- package/core/services/vault/transfers.ts +699 -576
- package/core/services/vault/vaultStore.ts +12 -10
- package/core/services/walletArgLimits.ts +1 -2
- package/core/services/walletConnectionValidation.ts +44 -28
- package/core/services/walletServiceConfig.ts +9 -40
- package/core/storage/StorageExpoSQLite.ts +7 -21
- package/core/storage/methods/listActionsSql.ts +81 -67
- package/core/storage/methods/listOutputsSql.ts +21 -16
- package/core/storage/methods/reviewStatusSql.ts +1 -4
- package/core/stores/ConnectionStore.ts +1 -1
- package/core/theme/ThemeContext.tsx +12 -16
- package/core/theme/motion.ts +3 -3
- package/core/theme/tokens.ts +6 -6
- package/core/toolboxConfig.ts +23 -0
- package/core/walletDbRegistry.ts +7 -5
- package/core/walletRepair/runWalletCheck.ts +1 -4
- package/package.json +2 -2
- package/ui/components/pay/AddressReceive.tsx +3 -3
- package/ui/components/pay/HandleReceive.tsx +15 -15
- package/ui/components/pay/MessageBoxConfig.tsx +46 -20
- package/ui/components/pay/NearbyFlow.tsx +575 -507
- package/ui/components/pay/OfflineNotice.tsx +1 -3
- package/ui/components/pay/PayCellRow.tsx +1 -4
- package/ui/components/pay/PayForm.tsx +1 -3
- package/ui/components/pay/RequestHub.tsx +14 -6
- package/ui/components/pay/UniversalSend.tsx +79 -27
- package/ui/components/pay/tokenSendCopy.ts +1 -2
- package/ui/components/pay/useRecipientInput.ts +2 -2
- package/ui/components/security/WalletLockNotice.tsx +1 -3
- package/ui/components/ui/AlertCard.tsx +44 -45
- package/ui/components/ui/BlurChrome.tsx +4 -15
- package/ui/components/ui/Celebration.tsx +3 -3
- package/ui/components/ui/ChoiceSheet.ts +1 -3
- package/ui/components/ui/ErrorBoundary.tsx +2 -6
- package/ui/components/ui/GroupedList.tsx +13 -31
- package/ui/components/ui/IconButton.tsx +6 -9
- package/ui/components/ui/ListRow.tsx +19 -25
- package/ui/components/ui/PresenceRow.tsx +4 -4
- package/ui/components/ui/PressableScale.tsx +24 -20
- package/ui/components/ui/Toast.tsx +23 -16
- package/ui/components/vault/KeyChooser.tsx +9 -6
- package/ui/components/vault/VaultBackdrop.tsx +1 -8
- package/ui/components/vault/VaultCeremonySheet.tsx +5 -5
- package/ui/components/wallet/ActivityRow.tsx +3 -2
- package/ui/components/wallet/BackupReminderSheet.tsx +1 -5
- package/ui/components/wallet/Balance.tsx +4 -1
- package/ui/components/wallet/ContactActivityList.tsx +7 -7
- package/ui/components/wallet/IconPickerSheet.tsx +1 -5
- package/ui/components/wallet/ProfileSwitcherPopover.tsx +6 -1
- package/ui/components/wallet/tokenEviction.ts +4 -1
- package/ui/hooks/useMandala.ts +1 -7
- package/ui/hooks/useOfflineNoticeActions.ts +21 -27
- package/ui/hooks/useSpendableBalance.ts +2 -2
- package/ui/hooks/useVaultCoverage.ts +7 -1
- package/ui/index.ts +9 -1
- package/ui/resolveIdentity.ts +20 -8
- package/ui/screens/ConnectionsScreen.tsx +44 -18
- package/ui/screens/LogsScreen.tsx +24 -22
- package/ui/screens/PairScreen.tsx +85 -54
- package/ui/screens/PayScreen.tsx +5 -1
- package/ui/screens/ProfileScreen.tsx +0 -3
- package/ui/screens/TrustScreen.tsx +125 -80
- package/ui/screens/VaultScreen.tsx +19 -7
- package/ui/screens/VaultTransferScreen.tsx +5 -1
- package/ui/screens/WalletCheckScreen.tsx +14 -17
- package/ui/screens/WalletConfigScreen.tsx +414 -376
- package/ui/screens/WalletHomeScreen.tsx +47 -42
|
@@ -1642,7 +1642,9 @@ function NearbyFlow({
|
|
|
1642
1642
|
if (scanLatchRef.current) return
|
|
1643
1643
|
scanLatchRef.current = true
|
|
1644
1644
|
if (data.startsWith(POS_PREFIX)) {
|
|
1645
|
-
void decodePaymentRequest(data)
|
|
1645
|
+
void decodePaymentRequest(data)
|
|
1646
|
+
.then(adoptSession)
|
|
1647
|
+
.catch(() => fail('generic', t('invalid_qr_code')))
|
|
1646
1648
|
return
|
|
1647
1649
|
}
|
|
1648
1650
|
let session: Session
|
|
@@ -1852,10 +1854,14 @@ function NearbyFlow({
|
|
|
1852
1854
|
} catch (e) {
|
|
1853
1855
|
console.warn('[localpay] abortAction failed:', messageOf(e))
|
|
1854
1856
|
if (storage) {
|
|
1855
|
-
await queuePendingAbort(
|
|
1856
|
-
|
|
1857
|
-
originator: adminOriginator
|
|
1858
|
-
|
|
1857
|
+
await queuePendingAbort(
|
|
1858
|
+
storage,
|
|
1859
|
+
{ reference, originator: adminOriginator },
|
|
1860
|
+
{
|
|
1861
|
+
wallet: wallet as unknown as PendingAbortTagWallet,
|
|
1862
|
+
originator: adminOriginator
|
|
1863
|
+
}
|
|
1864
|
+
).catch(() => undefined)
|
|
1859
1865
|
}
|
|
1860
1866
|
}
|
|
1861
1867
|
})()
|
|
@@ -1976,10 +1982,14 @@ function NearbyFlow({
|
|
|
1976
1982
|
// same replay on the next wallet build.
|
|
1977
1983
|
async reference => {
|
|
1978
1984
|
if (!storage) return
|
|
1979
|
-
await queuePendingAbort(
|
|
1980
|
-
|
|
1981
|
-
originator: adminOriginator
|
|
1982
|
-
|
|
1985
|
+
await queuePendingAbort(
|
|
1986
|
+
storage,
|
|
1987
|
+
{ reference, originator: adminOriginator },
|
|
1988
|
+
{
|
|
1989
|
+
wallet: wallet as unknown as PendingAbortTagWallet,
|
|
1990
|
+
originator: adminOriginator
|
|
1991
|
+
}
|
|
1992
|
+
)
|
|
1983
1993
|
}
|
|
1984
1994
|
)
|
|
1985
1995
|
} catch (e) {
|
|
@@ -2137,10 +2147,14 @@ function NearbyFlow({
|
|
|
2137
2147
|
},
|
|
2138
2148
|
queueFailedAbort: async reference => {
|
|
2139
2149
|
if (!storage) return
|
|
2140
|
-
await queuePendingAbort(
|
|
2141
|
-
|
|
2142
|
-
originator: adminOriginator
|
|
2143
|
-
|
|
2150
|
+
await queuePendingAbort(
|
|
2151
|
+
storage,
|
|
2152
|
+
{ reference, originator: adminOriginator },
|
|
2153
|
+
{
|
|
2154
|
+
wallet: wallet as unknown as PendingAbortTagWallet,
|
|
2155
|
+
originator: adminOriginator
|
|
2156
|
+
}
|
|
2157
|
+
)
|
|
2144
2158
|
},
|
|
2145
2159
|
// P1-3: the payee's decline is unverifiable from here — watch the
|
|
2146
2160
|
// txid so a later reappearance on chain (the payee's claim was wrong,
|
|
@@ -2392,10 +2406,14 @@ function NearbyFlow({
|
|
|
2392
2406
|
},
|
|
2393
2407
|
queueFailedAbort: async reference => {
|
|
2394
2408
|
if (!storage) return
|
|
2395
|
-
await queuePendingAbort(
|
|
2396
|
-
|
|
2397
|
-
originator: adminOriginator
|
|
2398
|
-
|
|
2409
|
+
await queuePendingAbort(
|
|
2410
|
+
storage,
|
|
2411
|
+
{ reference, originator: adminOriginator },
|
|
2412
|
+
{
|
|
2413
|
+
wallet: wallet as unknown as PendingAbortTagWallet,
|
|
2414
|
+
originator: adminOriginator
|
|
2415
|
+
}
|
|
2416
|
+
)
|
|
2399
2417
|
}
|
|
2400
2418
|
}
|
|
2401
2419
|
)
|
|
@@ -2698,35 +2716,35 @@ function NearbyFlow({
|
|
|
2698
2716
|
}
|
|
2699
2717
|
|
|
2700
2718
|
const flowBody = (
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2719
|
+
<ScrollView
|
|
2720
|
+
style={{ flex: 1, backgroundColor: colors.background }}
|
|
2721
|
+
contentContainerStyle={[styles.scroll, { paddingBottom: insets.bottom + spacing.xxxl }]}
|
|
2722
|
+
keyboardShouldPersistTaps="handled"
|
|
2723
|
+
>
|
|
2724
|
+
{/* ══ Payer entry ══
|
|
2707
2725
|
The Pay screen's grid already asked which side of the exchange this
|
|
2708
2726
|
device is on, so there is no role choice left to make here and only
|
|
2709
2727
|
one action: raise the camera again. Reached only by dismissing the
|
|
2710
2728
|
scanner that opens on mount — a payee never sees this view, they go
|
|
2711
2729
|
straight to naming an amount. */}
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2730
|
+
{phase === 'entry' && initialRole === 'payer' && (
|
|
2731
|
+
<Animated.View entering={settleIn} style={styles.stage}>
|
|
2732
|
+
<View style={[styles.heroCircle, { backgroundColor: colors.fillTertiary }]}>
|
|
2733
|
+
<Ionicons name="qr-code-outline" size={44} color={colors.textSecondary} />
|
|
2734
|
+
</View>
|
|
2735
|
+
<View style={styles.gapLg} />
|
|
2736
|
+
{phaseTitle(t('local_pay_scan_qr'))}
|
|
2737
|
+
{supportText(t('pay_pre_nearby'))}
|
|
2738
|
+
<View style={styles.gapXl} />
|
|
2739
|
+
<PrimaryButton
|
|
2740
|
+
styles={styles}
|
|
2741
|
+
colors={colors}
|
|
2742
|
+
icon="scan-outline"
|
|
2743
|
+
label={t('local_pay_scan_qr')}
|
|
2744
|
+
onPress={() => openScanner('send_scan')}
|
|
2745
|
+
/>
|
|
2728
2746
|
|
|
2729
|
-
|
|
2747
|
+
{/* TEMPORARY simulator affordance — __DEV__ only, never ships.
|
|
2730
2748
|
The simulator has no camera, so the payer flow is unreachable
|
|
2731
2749
|
there. This mints an OPEN session (no amount) and feeds it
|
|
2732
2750
|
through the real `onSessionScanned`, so decodeSession and every
|
|
@@ -2734,207 +2752,207 @@ function NearbyFlow({
|
|
|
2734
2752
|
what you see is the genuine payer UI, not a mock.
|
|
2735
2753
|
supportsAwdl is false so selectTransport picks the QR path,
|
|
2736
2754
|
which is the one a simulator can actually complete. */}
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
)
|
|
2755
|
+
{__DEV__ && (
|
|
2756
|
+
<>
|
|
2757
|
+
<View style={styles.gapMd} />
|
|
2758
|
+
<SecondaryButton
|
|
2759
|
+
styles={styles}
|
|
2760
|
+
colors={colors}
|
|
2761
|
+
icon="construct"
|
|
2762
|
+
label="DEV: pay an open request"
|
|
2763
|
+
onPress={() => {
|
|
2764
|
+
scanLatchRef.current = false
|
|
2765
|
+
onSessionScanned(
|
|
2766
|
+
encodeSession(
|
|
2767
|
+
mintSession({
|
|
2768
|
+
// secp256k1 generator point: a genuinely valid
|
|
2769
|
+
// compressed pubkey, so key derivation won't throw.
|
|
2770
|
+
identityKey: '0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798',
|
|
2771
|
+
derivationPrefix: 'ZGV2LXByZWZpeA==',
|
|
2772
|
+
derivationSuffix: 'ZGV2LXN1ZmZpeA==',
|
|
2773
|
+
supportsAwdl: false
|
|
2774
|
+
})
|
|
2758
2775
|
)
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2776
|
+
)
|
|
2777
|
+
}}
|
|
2778
|
+
/>
|
|
2779
|
+
</>
|
|
2780
|
+
)}
|
|
2781
|
+
</Animated.View>
|
|
2782
|
+
)}
|
|
2765
2783
|
|
|
2766
|
-
|
|
2784
|
+
{/* ══ Receive: amount ══
|
|
2767
2785
|
Focal: the amount field. Everything else on the view is a label. */}
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2786
|
+
{phase === 'receive_amount' && (
|
|
2787
|
+
<Animated.View entering={settleIn}>
|
|
2788
|
+
{phaseTitle(t('local_pay_request'))}
|
|
2789
|
+
<View style={styles.gapXl} />
|
|
2772
2790
|
|
|
2773
|
-
|
|
2791
|
+
{/* No max button and no balance line: this asks the PAYER for money,
|
|
2774
2792
|
so the requester's own balance is meaningless here. Zero or blank
|
|
2775
2793
|
is a real choice — payer decides — and the design says so by not
|
|
2776
2794
|
gating on it. */}
|
|
2777
|
-
|
|
2778
|
-
|
|
2795
|
+
<PayAmountField value={requestAmount} onChangeText={setRequestAmount} showMax={false} showBalance={false} />
|
|
2796
|
+
{/* Never disabled. Leaving the amount at zero is a real choice — it
|
|
2779
2797
|
means "payer decides" — so gating Continue on a non-zero amount
|
|
2780
2798
|
would make that choice unreachable. startRequest maps 0 to an
|
|
2781
2799
|
open session. */}
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2800
|
+
<PrimaryButton
|
|
2801
|
+
styles={styles}
|
|
2802
|
+
colors={colors}
|
|
2803
|
+
label={t('continue_action')}
|
|
2804
|
+
onPress={() => void startRequest(satsFrom(requestAmount) || undefined)}
|
|
2805
|
+
/>
|
|
2806
|
+
<CancelButton styles={styles} colors={colors} label={t('cancel')} onPress={reset} />
|
|
2807
|
+
</Animated.View>
|
|
2808
|
+
)}
|
|
2791
2809
|
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2810
|
+
{/* Focal on each of these: the single status line. */}
|
|
2811
|
+
{phase === 'receive_minting' && spinnerBlock(t('local_pay_preparing'))}
|
|
2812
|
+
{phase === 'receive_settling' && spinnerBlock(t('local_pay_saving'))}
|
|
2813
|
+
{phase === 'send_working' && spinnerBlock(t('local_pay_delivering'))}
|
|
2796
2814
|
|
|
2797
|
-
|
|
2815
|
+
{/* ══ Receive: pairing QR (always) + AWDL listener (when supported) ══
|
|
2798
2816
|
Focal: the pairing code. This is the one view whose focal element is
|
|
2799
2817
|
not the amount, and deliberately: the code is the object being
|
|
2800
2818
|
physically held up to another person, and shrinking a working
|
|
2801
2819
|
scanner target to win a typographic argument would be the wrong
|
|
2802
2820
|
trade. The amount sits above it at title scale, as the code's price. */}
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2821
|
+
{phase === 'receive_wait' && hostedSession && (
|
|
2822
|
+
<Animated.View entering={settleIn} style={styles.stage}>
|
|
2823
|
+
{phaseTitle(t('local_pay_show_qr'))}
|
|
2824
|
+
<Text
|
|
2825
|
+
style={[styles.amountTitle, { color: colors.textSecondary }]}
|
|
2826
|
+
maxFontSizeMultiplier={1.4}
|
|
2827
|
+
numberOfLines={1}
|
|
2828
|
+
>
|
|
2829
|
+
{hostedSession.amount === undefined ? (
|
|
2830
|
+
t('local_pay_any_amount')
|
|
2831
|
+
) : hostedSession.asset ? (
|
|
2832
|
+
formatTokenAmountWithUnit(hostedSession.amount, {
|
|
2833
|
+
decimals: hostedSession.asset.decimals ?? 0,
|
|
2834
|
+
ticker: hostedSession.asset.ticker ?? ''
|
|
2835
|
+
})
|
|
2836
|
+
) : (
|
|
2837
|
+
<AmountDisplay>{hostedSession.amount}</AmountDisplay>
|
|
2838
|
+
)}
|
|
2839
|
+
</Text>
|
|
2840
|
+
<View style={styles.gapLg} />
|
|
2823
2841
|
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2842
|
+
{sessionQr && !sessionQrBroken ? (
|
|
2843
|
+
<View style={[styles.qrCard, { shadowColor: colors.textPrimary }]}>
|
|
2844
|
+
<View style={styles.qrPlate}>
|
|
2845
|
+
{/* onError is mandatory: without it the encoder rethrows from
|
|
2828
2846
|
render and the app-level ErrorBoundary swallows the app. */}
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
</View>
|
|
2838
|
-
</View>
|
|
2839
|
-
) : (
|
|
2840
|
-
// Error state for this data area. The session cannot be handed
|
|
2841
|
-
// over at all, so the only way forward is a fresh one.
|
|
2842
|
-
<View
|
|
2843
|
-
style={[styles.qrError, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
|
|
2844
|
-
accessibilityRole="alert"
|
|
2845
|
-
>
|
|
2846
|
-
<Ionicons name="alert-circle-outline" size={28} color={colors.error} />
|
|
2847
|
-
<View style={styles.gapSm} />
|
|
2848
|
-
<Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_qr_unavailable')}</Text>
|
|
2847
|
+
<QRCode
|
|
2848
|
+
value={sessionQr}
|
|
2849
|
+
size={PAYMENT_QR_SIZE}
|
|
2850
|
+
ecl="M"
|
|
2851
|
+
color="#000"
|
|
2852
|
+
backgroundColor="#fff"
|
|
2853
|
+
onError={onSessionQrError}
|
|
2854
|
+
/>
|
|
2849
2855
|
</View>
|
|
2850
|
-
|
|
2856
|
+
</View>
|
|
2857
|
+
) : (
|
|
2858
|
+
// Error state for this data area. The session cannot be handed
|
|
2859
|
+
// over at all, so the only way forward is a fresh one.
|
|
2860
|
+
<View
|
|
2861
|
+
style={[styles.qrError, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
|
|
2862
|
+
accessibilityRole="alert"
|
|
2863
|
+
>
|
|
2864
|
+
<Ionicons name="alert-circle-outline" size={28} color={colors.error} />
|
|
2865
|
+
<View style={styles.gapSm} />
|
|
2866
|
+
<Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_qr_unavailable')}</Text>
|
|
2867
|
+
</View>
|
|
2868
|
+
)}
|
|
2851
2869
|
|
|
2852
|
-
|
|
2853
|
-
|
|
2870
|
+
<View style={styles.gapLg} />
|
|
2871
|
+
{presenceBlock}
|
|
2854
2872
|
|
|
2855
|
-
|
|
2873
|
+
{/* A frame arrived that could not be credited. Advisory, not a
|
|
2856
2874
|
failure: this session was deliberately NOT marked spent, so
|
|
2857
2875
|
the pairing QR above is still live for the real payer. `notice`
|
|
2858
2876
|
(set only for a token frame that failed COVER) names the
|
|
2859
2877
|
ISSUER's records as the reason — a specific true sentence beats
|
|
2860
2878
|
the generic "wrong session" one, and must never read as a
|
|
2861
2879
|
scanning mistake this device made (ux design §4.3). */}
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
<Animated.View
|
|
2869
|
-
entering={fadeIn}
|
|
2870
|
-
style={[styles.notice, { backgroundColor: colors.error + '15', borderColor: colors.error + '40' }]}
|
|
2871
|
-
accessibilityRole="alert"
|
|
2872
|
-
>
|
|
2873
|
-
<Ionicons name="alert-circle-outline" size={16} color={colors.error} />
|
|
2874
|
-
<Text style={[styles.noticeText, { color: colors.error }]}>{t('local_pay_wrong_session')}</Text>
|
|
2875
|
-
</Animated.View>
|
|
2876
|
-
)}
|
|
2877
|
-
</>
|
|
2878
|
-
)}
|
|
2879
|
-
|
|
2880
|
-
{/* A radio gave up. The request is still live over QR — and over
|
|
2881
|
-
any other radio still listening — so each of these is an
|
|
2882
|
-
advisory, not a failure: the pairing QR above still works. */}
|
|
2883
|
-
{radioFailures.map(([kind, err]) => (
|
|
2884
|
-
<React.Fragment key={kind}>
|
|
2885
|
-
<View style={styles.gapLg} />
|
|
2880
|
+
{sessionMismatch && (
|
|
2881
|
+
<>
|
|
2882
|
+
<View style={styles.gapLg} />
|
|
2883
|
+
{notice ? (
|
|
2884
|
+
noticeBlock(notice)
|
|
2885
|
+
) : (
|
|
2886
2886
|
<Animated.View
|
|
2887
2887
|
entering={fadeIn}
|
|
2888
|
-
style={[styles.notice, { backgroundColor: colors.
|
|
2888
|
+
style={[styles.notice, { backgroundColor: colors.error + '15', borderColor: colors.error + '40' }]}
|
|
2889
|
+
accessibilityRole="alert"
|
|
2889
2890
|
>
|
|
2890
|
-
<Ionicons name="
|
|
2891
|
-
<Text style={[styles.noticeText, { color: colors.
|
|
2892
|
-
{err.networkDenied
|
|
2893
|
-
? t('local_pay_network_denied')
|
|
2894
|
-
: kind === 'ble'
|
|
2895
|
-
? t('local_pay_ble_unavailable')
|
|
2896
|
-
: t('local_pay_nearby_unavailable')}
|
|
2897
|
-
</Text>
|
|
2891
|
+
<Ionicons name="alert-circle-outline" size={16} color={colors.error} />
|
|
2892
|
+
<Text style={[styles.noticeText, { color: colors.error }]}>{t('local_pay_wrong_session')}</Text>
|
|
2898
2893
|
</Animated.View>
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2894
|
+
)}
|
|
2895
|
+
</>
|
|
2896
|
+
)}
|
|
2897
|
+
|
|
2898
|
+
{/* A radio gave up. The request is still live over QR — and over
|
|
2899
|
+
any other radio still listening — so each of these is an
|
|
2900
|
+
advisory, not a failure: the pairing QR above still works. */}
|
|
2901
|
+
{radioFailures.map(([kind, err]) => (
|
|
2902
|
+
<React.Fragment key={kind}>
|
|
2903
|
+
<View style={styles.gapLg} />
|
|
2904
|
+
<Animated.View
|
|
2905
|
+
entering={fadeIn}
|
|
2906
|
+
style={[styles.notice, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
|
|
2907
|
+
>
|
|
2908
|
+
<Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
|
|
2909
|
+
<Text style={[styles.noticeText, { color: colors.textSecondary }]}>
|
|
2910
|
+
{err.networkDenied
|
|
2911
|
+
? t('local_pay_network_denied')
|
|
2912
|
+
: kind === 'ble'
|
|
2913
|
+
? t('local_pay_ble_unavailable')
|
|
2914
|
+
: t('local_pay_nearby_unavailable')}
|
|
2915
|
+
</Text>
|
|
2916
|
+
</Animated.View>
|
|
2917
|
+
</React.Fragment>
|
|
2918
|
+
))}
|
|
2919
|
+
|
|
2920
|
+
<View style={styles.gapXl} />
|
|
2921
|
+
{radioFailures.some(([, err]) => err.networkDenied) && (
|
|
2922
|
+
<>
|
|
2923
|
+
<SecondaryButton
|
|
2924
|
+
styles={styles}
|
|
2925
|
+
colors={colors}
|
|
2926
|
+
icon="settings-outline"
|
|
2927
|
+
label={t('open_settings')}
|
|
2928
|
+
onPress={() => void Linking.openSettings()}
|
|
2929
|
+
/>
|
|
2930
|
+
<View style={styles.gapMd} />
|
|
2931
|
+
</>
|
|
2932
|
+
)}
|
|
2933
|
+
<SecondaryButton
|
|
2934
|
+
styles={styles}
|
|
2935
|
+
colors={colors}
|
|
2936
|
+
icon="scan-outline"
|
|
2937
|
+
label={t('local_pay_scan_payer_qr')}
|
|
2938
|
+
onPress={() => openScanner('receive_scan')}
|
|
2939
|
+
/>
|
|
2940
|
+
<CancelButton styles={styles} colors={colors} label={t('cancel')} onPress={reset} />
|
|
2941
|
+
</Animated.View>
|
|
2942
|
+
)}
|
|
2925
2943
|
|
|
2926
|
-
|
|
2944
|
+
{/* ══ Send: confirm ══
|
|
2927
2945
|
Focal: the amount — the figure being handed over, at display scale
|
|
2928
2946
|
when the payee fixed it, or the live field when they left it open. */}
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2947
|
+
{phase === 'send_confirm' && scannedSession && (
|
|
2948
|
+
<Animated.View entering={settleIn}>
|
|
2949
|
+
{phaseTitle(scannedSession.amount === undefined ? t('local_pay_choose_amount') : t('local_pay_send'))}
|
|
2950
|
+
|
|
2951
|
+
{scannedSession.amount === undefined ? (
|
|
2952
|
+
<>
|
|
2953
|
+
{supportText(t('local_pay_enter_amount_send'))}
|
|
2954
|
+
<View style={styles.gapXl} />
|
|
2955
|
+
{/* Token mode on a token session: the field takes and emits base
|
|
2938
2956
|
units of the payee's asset and labels itself with its ticker,
|
|
2939
2957
|
Max writes this payer's real holding, and the line under it is
|
|
2940
2958
|
that holding — never the BSV spendable figure, which is the
|
|
@@ -2942,283 +2960,288 @@ function NearbyFlow({
|
|
|
2942
2960
|
the payer would be typing satoshis against a USDX request,
|
|
2943
2961
|
and Max would write the satoshi send-max sentinel straight
|
|
2944
2962
|
into a token build. */}
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2963
|
+
<PayAmountField
|
|
2964
|
+
value={sendAmount}
|
|
2965
|
+
onChangeText={setSendAmount}
|
|
2966
|
+
asset={scannedAssetUnits}
|
|
2967
|
+
maxValue={scannedHolding && !unitsUnknown ? String(scannedHolding.baseUnits) : undefined}
|
|
2968
|
+
availableText={
|
|
2969
|
+
scannedHolding && scannedAssetUnits && !unitsUnknown
|
|
2970
|
+
? (formatTokenAmount(scannedHolding.baseUnits, scannedAssetUnits.decimals) ?? undefined)
|
|
2971
|
+
: undefined
|
|
2972
|
+
}
|
|
2973
|
+
// No money chrome at all while the unit is unknown: an
|
|
2974
|
+
// unlabelled balance is exactly the figure principle 4 forbids.
|
|
2975
|
+
showBalance={!scannedAssetUnits || (scannedHolding != null && !unitsUnknown)}
|
|
2976
|
+
/>
|
|
2977
|
+
</>
|
|
2978
|
+
) : (
|
|
2979
|
+
<>
|
|
2980
|
+
<View style={styles.stageTight}>
|
|
2981
|
+
{unitsUnknown ? (
|
|
2982
|
+
// The payee named a figure this device cannot denominate:
|
|
2983
|
+
// a bare number at a guessed scale is exactly what must not
|
|
2984
|
+
// be printed (principle 4), so the slot says so instead.
|
|
2985
|
+
<Animated.View entering={settleIn} style={styles.amountBlock}>
|
|
2986
|
+
<Text
|
|
2987
|
+
style={[styles.amountDisplay, { color: colors.textSecondary }]}
|
|
2988
|
+
maxFontSizeMultiplier={1.3}
|
|
2989
|
+
numberOfLines={1}
|
|
2990
|
+
adjustsFontSizeToFit
|
|
2991
|
+
accessibilityRole="text"
|
|
2992
|
+
>
|
|
2993
|
+
{t('token_row_amount_pending')}
|
|
2994
|
+
</Text>
|
|
2995
|
+
</Animated.View>
|
|
2996
|
+
) : (
|
|
2997
|
+
amountBlock(scannedSession.amount, undefined, scannedAssetUnits)
|
|
2998
|
+
)}
|
|
2999
|
+
</View>
|
|
3000
|
+
<View style={styles.gapXl} />
|
|
3001
|
+
{/* The payer's own BSV balance is the fee balance and says
|
|
2984
3002
|
nothing about what they hold of the asset; on a token
|
|
2985
3003
|
request it would be a figure beside an unrelated one. */}
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
<PayField labelKey="note">
|
|
2991
|
-
<TextInput
|
|
2992
|
-
value={note}
|
|
2993
|
-
onChangeText={setNote}
|
|
2994
|
-
placeholder={t('note_placeholder')}
|
|
2995
|
-
placeholderTextColor={colors.textQuaternary}
|
|
2996
|
-
maxLength={280}
|
|
2997
|
-
style={[
|
|
2998
|
-
styles.noteInput,
|
|
2999
|
-
{
|
|
3000
|
-
backgroundColor: colors.backgroundSecondary,
|
|
3001
|
-
borderColor: colors.separator,
|
|
3002
|
-
color: colors.textPrimary
|
|
3003
|
-
}
|
|
3004
|
-
]}
|
|
3005
|
-
/>
|
|
3006
|
-
</PayField>
|
|
3004
|
+
{!scannedSession.asset && <AvailableBalance withUnit />}
|
|
3005
|
+
</>
|
|
3006
|
+
)}
|
|
3007
3007
|
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3008
|
+
<PayField labelKey="note">
|
|
3009
|
+
<TextInput
|
|
3010
|
+
value={note}
|
|
3011
|
+
onChangeText={setNote}
|
|
3012
|
+
placeholder={t('note_placeholder')}
|
|
3013
|
+
placeholderTextColor={colors.textQuaternary}
|
|
3014
|
+
maxLength={280}
|
|
3015
|
+
style={[
|
|
3016
|
+
styles.noteInput,
|
|
3017
|
+
{
|
|
3018
|
+
backgroundColor: colors.backgroundSecondary,
|
|
3019
|
+
borderColor: colors.separator,
|
|
3020
|
+
color: colors.textPrimary
|
|
3021
|
+
}
|
|
3022
|
+
]}
|
|
3011
3023
|
/>
|
|
3024
|
+
</PayField>
|
|
3025
|
+
|
|
3026
|
+
<RecipientSummary
|
|
3027
|
+
name={peerName ?? scannedSession.merchantName ?? abbreviateKey(scannedSession.identityKey)}
|
|
3028
|
+
detail={
|
|
3029
|
+
scannedSession.merchantName
|
|
3030
|
+
? `Merchant · ${abbreviateKey(scannedSession.identityKey)}`
|
|
3031
|
+
: peerName
|
|
3032
|
+
? abbreviateKey(scannedSession.identityKey)
|
|
3033
|
+
: undefined
|
|
3034
|
+
}
|
|
3035
|
+
/>
|
|
3012
3036
|
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
<>
|
|
3021
|
-
<View style={styles.gapLg} />
|
|
3022
|
-
{supportText(t(FLOOR_KEYS[floorReason]))}
|
|
3023
|
-
{floorReason === 'local_ble_denied' && (
|
|
3024
|
-
<>
|
|
3025
|
-
<View style={styles.gapMd} />
|
|
3026
|
-
<SecondaryButton
|
|
3027
|
-
styles={styles}
|
|
3028
|
-
colors={colors}
|
|
3029
|
-
icon="settings-outline"
|
|
3030
|
-
label={t('open_settings')}
|
|
3031
|
-
onPress={() => void Linking.openSettings()}
|
|
3032
|
-
/>
|
|
3033
|
-
</>
|
|
3034
|
-
)}
|
|
3035
|
-
</>
|
|
3037
|
+
{!!scannedSession.merchantTip &&
|
|
3038
|
+
supportText(
|
|
3039
|
+
t('merchant_tip_breakdown', {
|
|
3040
|
+
defaultValue: '{{subtotal}} sats sale + {{tip}} sats tip',
|
|
3041
|
+
subtotal: scannedSession.merchantSubtotal?.toLocaleString(),
|
|
3042
|
+
tip: scannedSession.merchantTip.toLocaleString()
|
|
3043
|
+
})
|
|
3036
3044
|
)}
|
|
3045
|
+
<View style={styles.gapLg} />
|
|
3046
|
+
{presenceBlock}
|
|
3047
|
+
{floorReason !== 'none' && (
|
|
3048
|
+
<>
|
|
3049
|
+
<View style={styles.gapLg} />
|
|
3050
|
+
{supportText(t(FLOOR_KEYS[floorReason]))}
|
|
3051
|
+
{floorReason === 'local_ble_denied' && (
|
|
3052
|
+
<>
|
|
3053
|
+
<View style={styles.gapMd} />
|
|
3054
|
+
<SecondaryButton
|
|
3055
|
+
styles={styles}
|
|
3056
|
+
colors={colors}
|
|
3057
|
+
icon="settings-outline"
|
|
3058
|
+
label={t('open_settings')}
|
|
3059
|
+
onPress={() => void Linking.openSettings()}
|
|
3060
|
+
/>
|
|
3061
|
+
</>
|
|
3062
|
+
)}
|
|
3063
|
+
</>
|
|
3064
|
+
)}
|
|
3037
3065
|
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3066
|
+
{overHolding && scannedAssetUnits && !unitsUnknown && (
|
|
3067
|
+
<>
|
|
3068
|
+
<View style={styles.gapLg} />
|
|
3069
|
+
{supportText(t('pay_asset_over_balance', { ticker: scannedAssetUnits.ticker }))}
|
|
3070
|
+
</>
|
|
3071
|
+
)}
|
|
3072
|
+
{unitsUnknown && (
|
|
3073
|
+
<>
|
|
3074
|
+
<View style={styles.gapLg} />
|
|
3075
|
+
{supportText(t('pay_asset_unidentified'))}
|
|
3076
|
+
</>
|
|
3077
|
+
)}
|
|
3078
|
+
<View style={styles.gapXl} />
|
|
3079
|
+
<PrimaryButton
|
|
3080
|
+
styles={styles}
|
|
3081
|
+
colors={colors}
|
|
3082
|
+
icon="arrow-up"
|
|
3083
|
+
label={t('local_pay_send')}
|
|
3084
|
+
disabled={!canSend}
|
|
3085
|
+
onPress={() => void executeSend()}
|
|
3086
|
+
/>
|
|
3087
|
+
<CancelButton styles={styles} colors={colors} label={t('cancel')} onPress={reset} />
|
|
3088
|
+
</Animated.View>
|
|
3089
|
+
)}
|
|
3062
3090
|
|
|
3063
|
-
|
|
3091
|
+
{/* ══ Send: hand the frame over as a QR ══
|
|
3064
3092
|
Focal: the payment code. The amount is settled by this point and
|
|
3065
3093
|
demotes to a caption. */}
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
)}
|
|
3079
|
-
</Text>
|
|
3080
|
-
{paymentQrBlocks > 1 && (
|
|
3081
|
-
<Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_animated_hint')}</Text>
|
|
3094
|
+
{phase === 'send_qr' && paymentQr && (
|
|
3095
|
+
<Animated.View entering={settleIn} style={styles.stage}>
|
|
3096
|
+
{phaseTitle(t('local_pay_show_payment_qr'))}
|
|
3097
|
+
<Text
|
|
3098
|
+
style={[styles.amountTitle, { color: colors.textSecondary }]}
|
|
3099
|
+
maxFontSizeMultiplier={1.4}
|
|
3100
|
+
numberOfLines={1}
|
|
3101
|
+
>
|
|
3102
|
+
{scannedAssetUnits ? (
|
|
3103
|
+
formatTokenAmountWithUnit(payAmount, scannedAssetUnits)
|
|
3104
|
+
) : (
|
|
3105
|
+
<AmountDisplay>{payAmount}</AmountDisplay>
|
|
3082
3106
|
)}
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3107
|
+
</Text>
|
|
3108
|
+
{paymentQrBlocks > 1 && (
|
|
3109
|
+
<Text style={[styles.support, { color: colors.textSecondary }]}>{t('local_pay_animated_hint')}</Text>
|
|
3110
|
+
)}
|
|
3111
|
+
<View style={styles.gapLg} />
|
|
3112
|
+
<View style={[styles.qrCard, { shadowColor: colors.textPrimary }]}>
|
|
3113
|
+
<View style={styles.qrPlate}>
|
|
3114
|
+
{/* onError is mandatory: without it an oversize payload rethrows
|
|
3087
3115
|
from render and the app-level ErrorBoundary swallows the app. */}
|
|
3088
|
-
|
|
3089
|
-
</View>
|
|
3116
|
+
<PaymentQrDisplay frameQr={paymentQr} size={PAYMENT_QR_SIZE} onError={onPaymentQrError} />
|
|
3090
3117
|
</View>
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3118
|
+
</View>
|
|
3119
|
+
<View style={styles.gapLg} />
|
|
3120
|
+
{presenceBlock}
|
|
3121
|
+
{!!notice && (
|
|
3122
|
+
<>
|
|
3123
|
+
<View style={styles.gapLg} />
|
|
3124
|
+
{noticeBlock(notice)}
|
|
3125
|
+
</>
|
|
3126
|
+
)}
|
|
3127
|
+
<View style={styles.gapXl} />
|
|
3128
|
+
{/* Done asserts delivery: persist the frame, then broadcast when
|
|
3101
3129
|
online (see completeQrDelivery / finalizeDelivery). Never an
|
|
3102
3130
|
abort — the payee may be about to broadcast this frame, and
|
|
3103
3131
|
freeing its inputs would let this wallet respend them. */}
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
colors={colors}
|
|
3107
|
-
label={t('done')}
|
|
3108
|
-
onPress={() => void completeQrDelivery()}
|
|
3109
|
-
/>
|
|
3110
|
-
{/* Not "Cancel": leaving keeps the payment exactly as Done does,
|
|
3132
|
+
<PrimaryButton styles={styles} colors={colors} label={t('done')} onPress={() => void completeQrDelivery()} />
|
|
3133
|
+
{/* Not "Cancel": leaving keeps the payment exactly as Done does,
|
|
3111
3134
|
so the old label promised an abort that no longer happens. */}
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3135
|
+
<CancelButton
|
|
3136
|
+
styles={styles}
|
|
3137
|
+
colors={colors}
|
|
3138
|
+
label={t('back')}
|
|
3139
|
+
onPress={() => void handleSendQrExit(false)}
|
|
3140
|
+
/>
|
|
3141
|
+
</Animated.View>
|
|
3142
|
+
)}
|
|
3120
3143
|
|
|
3121
|
-
|
|
3144
|
+
{/* ══ Done ══
|
|
3122
3145
|
Focal: the amount. The celebration mark is a transient overlay that
|
|
3123
3146
|
owns attention for ~700ms and then hands it back, so the two never
|
|
3124
3147
|
compete for the same beat. */}
|
|
3125
|
-
|
|
3148
|
+
{/* ══ Already paid — a success terminal, not an error ══
|
|
3126
3149
|
Focal: the headline. There is no figure to show — this device never
|
|
3127
3150
|
saw a second payment — so nothing here is at display scale. */}
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3151
|
+
{phase === 'already_paid' && (
|
|
3152
|
+
<Animated.View entering={settleIn} style={styles.stage}>
|
|
3153
|
+
<Ionicons name="checkmark-done-circle-outline" size={56} color={colors.textSecondary} />
|
|
3154
|
+
<View style={styles.gapLg} />
|
|
3155
|
+
{phaseTitle(t('local_pay_already_paid'))}
|
|
3156
|
+
{supportText(t('local_pay_queued'))}
|
|
3157
|
+
<View style={styles.gapXl} />
|
|
3158
|
+
{/* Deliberately no retry: reset() would mint a fresh session and ask
|
|
3136
3159
|
the payer to pay a second time for money already queued here. */}
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3160
|
+
<PrimaryButton styles={styles} colors={colors} label={t('done')} onPress={goBack} />
|
|
3161
|
+
</Animated.View>
|
|
3162
|
+
)}
|
|
3140
3163
|
|
|
3141
|
-
|
|
3164
|
+
{/* ══ Failed ══
|
|
3142
3165
|
Focal: the reason. The title is generic by design, so the sentence
|
|
3143
3166
|
under it carries the information and gets the weight. */}
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3167
|
+
{phase === 'failed' && (
|
|
3168
|
+
<Animated.View entering={settleIn} style={styles.stage} accessibilityRole="alert">
|
|
3169
|
+
<View style={[styles.heroCircle, { backgroundColor: colors.error + '15' }]}>
|
|
3170
|
+
<Ionicons name="alert-circle-outline" size={40} color={colors.error} />
|
|
3171
|
+
</View>
|
|
3172
|
+
<View style={styles.gapLg} />
|
|
3173
|
+
{phaseTitle(t('local_pay_failed'))}
|
|
3174
|
+
<Text style={[styles.reason, { color: colors.textPrimary }]} textBreakStrategy="balanced">
|
|
3175
|
+
{failure?.detail}
|
|
3176
|
+
</Text>
|
|
3177
|
+
<View style={styles.gapXl} />
|
|
3178
|
+
|
|
3179
|
+
{/* A frame reached this device but never reached storage. Retry the
|
|
3157
3180
|
SAME session — reset() would mint one that can never receive it. */}
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3181
|
+
{unsettled && (
|
|
3182
|
+
<>
|
|
3183
|
+
<PrimaryButton
|
|
3184
|
+
styles={styles}
|
|
3185
|
+
colors={colors}
|
|
3186
|
+
icon="refresh"
|
|
3187
|
+
label={t('local_pay_retry_save')}
|
|
3188
|
+
onPress={retrySettle}
|
|
3189
|
+
/>
|
|
3190
|
+
<View style={styles.gapMd} />
|
|
3191
|
+
</>
|
|
3192
|
+
)}
|
|
3170
3193
|
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3194
|
+
{failure?.settings && (
|
|
3195
|
+
<>
|
|
3196
|
+
<SecondaryButton
|
|
3197
|
+
styles={styles}
|
|
3198
|
+
colors={colors}
|
|
3199
|
+
icon="settings-outline"
|
|
3200
|
+
label={t('open_settings')}
|
|
3201
|
+
onPress={() => void Linking.openSettings()}
|
|
3202
|
+
/>
|
|
3203
|
+
<View style={styles.gapMd} />
|
|
3204
|
+
</>
|
|
3205
|
+
)}
|
|
3183
3206
|
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3207
|
+
{failure?.offerWalletCheck && (
|
|
3208
|
+
<>
|
|
3209
|
+
<SecondaryButton
|
|
3210
|
+
styles={styles}
|
|
3211
|
+
colors={colors}
|
|
3212
|
+
label={t('check_wallet')}
|
|
3213
|
+
onPress={() => router.push('/wallet-check' as never)}
|
|
3214
|
+
/>
|
|
3215
|
+
<View style={styles.gapMd} />
|
|
3216
|
+
</>
|
|
3217
|
+
)}
|
|
3195
3218
|
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3219
|
+
{paymentQr && (
|
|
3220
|
+
<>
|
|
3221
|
+
<SecondaryButton
|
|
3222
|
+
styles={styles}
|
|
3223
|
+
colors={colors}
|
|
3224
|
+
icon="qr-code-outline"
|
|
3225
|
+
label={t('local_pay_show_qr_instead')}
|
|
3226
|
+
onPress={() => {
|
|
3227
|
+
setFailure(null)
|
|
3228
|
+
setPhase('send_qr')
|
|
3229
|
+
}}
|
|
3230
|
+
/>
|
|
3231
|
+
<View style={styles.gapMd} />
|
|
3232
|
+
</>
|
|
3233
|
+
)}
|
|
3211
3234
|
|
|
3212
|
-
|
|
3235
|
+
{/* With a frame in hand, reset() means abandoning it — the frame lives
|
|
3213
3236
|
only in memory — so it is demoted to the secondary action. */}
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3237
|
+
{unsettled ? (
|
|
3238
|
+
<CancelButton styles={styles} colors={colors} label={t('cancel')} onPress={reset} />
|
|
3239
|
+
) : (
|
|
3240
|
+
<PrimaryButton styles={styles} colors={colors} label={t('retry')} onPress={retry} />
|
|
3241
|
+
)}
|
|
3242
|
+
</Animated.View>
|
|
3243
|
+
)}
|
|
3244
|
+
</ScrollView>
|
|
3222
3245
|
)
|
|
3223
3246
|
|
|
3224
3247
|
/**
|
|
@@ -3259,7 +3282,15 @@ function NearbyFlow({
|
|
|
3259
3282
|
</View>
|
|
3260
3283
|
) : phase === 'receive_wait' && hostedSession ? (
|
|
3261
3284
|
<View
|
|
3262
|
-
style={[
|
|
3285
|
+
style={[
|
|
3286
|
+
styles.qrError,
|
|
3287
|
+
{
|
|
3288
|
+
width: embeddedQrSize,
|
|
3289
|
+
height: embeddedQrSize,
|
|
3290
|
+
backgroundColor: colors.fillTertiary,
|
|
3291
|
+
borderColor: colors.separator
|
|
3292
|
+
}
|
|
3293
|
+
]}
|
|
3263
3294
|
accessibilityRole="alert"
|
|
3264
3295
|
>
|
|
3265
3296
|
<Ionicons name="alert-circle-outline" size={28} color={colors.error} />
|
|
@@ -3269,7 +3300,10 @@ function NearbyFlow({
|
|
|
3269
3300
|
) : (
|
|
3270
3301
|
// the code's own footprint, so the host's layout does not jump
|
|
3271
3302
|
<View
|
|
3272
|
-
style={[
|
|
3303
|
+
style={[
|
|
3304
|
+
styles.embeddedPending,
|
|
3305
|
+
{ width: embeddedQrSize + spacing.lg * 2, height: embeddedQrSize + spacing.lg * 2 }
|
|
3306
|
+
]}
|
|
3273
3307
|
accessibilityRole="progressbar"
|
|
3274
3308
|
accessibilityLabel={phase === 'receive_settling' ? t('local_pay_saving') : t('local_pay_preparing')}
|
|
3275
3309
|
>
|
|
@@ -3336,7 +3370,9 @@ function NearbyFlow({
|
|
|
3336
3370
|
accessibilityLabel={t('local_pay_scan_payer_qr')}
|
|
3337
3371
|
>
|
|
3338
3372
|
<Ionicons name="scan-outline" size={16} color={colors.textSecondary} />
|
|
3339
|
-
<Text style={[styles.embeddedScanText, { color: colors.textSecondary }]}>
|
|
3373
|
+
<Text style={[styles.embeddedScanText, { color: colors.textSecondary }]}>
|
|
3374
|
+
{t('local_pay_scan_payer_qr')}
|
|
3375
|
+
</Text>
|
|
3340
3376
|
</PressableScale>
|
|
3341
3377
|
</>
|
|
3342
3378
|
)}
|
|
@@ -3358,68 +3394,100 @@ function NearbyFlow({
|
|
|
3358
3394
|
role !== 'payer' || !renderPayer
|
|
3359
3395
|
? null
|
|
3360
3396
|
: phase === 'send_confirm' && scannedSession && renderPayer.confirm
|
|
3361
|
-
? {
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3397
|
+
? {
|
|
3398
|
+
node: (
|
|
3399
|
+
<Hosted
|
|
3400
|
+
render={renderPayer.confirm}
|
|
3401
|
+
value={{
|
|
3402
|
+
session: scannedSession,
|
|
3403
|
+
fixedAmount: scannedSession.amount,
|
|
3404
|
+
amount: payAmount,
|
|
3405
|
+
setAmount: units => setSendAmount(units !== undefined && units > 0 ? String(Math.round(units)) : ''),
|
|
3406
|
+
asset: scannedAssetUnits,
|
|
3407
|
+
holding: scannedHolding && !unitsUnknown ? scannedHolding.baseUnits : undefined,
|
|
3408
|
+
note,
|
|
3409
|
+
setNote,
|
|
3410
|
+
recipient: payerRecipient,
|
|
3411
|
+
tipText: scannedSession.merchantTip
|
|
3412
|
+
? t('merchant_tip_breakdown', {
|
|
3413
|
+
defaultValue: '{{subtotal}} sats sale + {{tip}} sats tip',
|
|
3414
|
+
subtotal: scannedSession.merchantSubtotal?.toLocaleString(),
|
|
3415
|
+
tip: scannedSession.merchantTip.toLocaleString()
|
|
3416
|
+
})
|
|
3417
|
+
: undefined,
|
|
3418
|
+
presence,
|
|
3419
|
+
advisories: [
|
|
3420
|
+
...(floorReason !== 'none' ? [t(FLOOR_KEYS[floorReason])] : []),
|
|
3421
|
+
...(overHolding && scannedAssetUnits && !unitsUnknown
|
|
3422
|
+
? [t('pay_asset_over_balance', { ticker: scannedAssetUnits.ticker })]
|
|
3423
|
+
: []),
|
|
3424
|
+
...(unitsUnknown ? [t('pay_asset_unidentified')] : [])
|
|
3425
|
+
],
|
|
3426
|
+
openSettings: floorReason === 'local_ble_denied' ? () => void Linking.openSettings() : undefined,
|
|
3427
|
+
canSend,
|
|
3428
|
+
send: () => void executeSend(),
|
|
3429
|
+
cancel: reset
|
|
3430
|
+
}}
|
|
3431
|
+
/>
|
|
3432
|
+
)
|
|
3433
|
+
}
|
|
3391
3434
|
: phase === 'send_working' && renderPayer.sending
|
|
3392
|
-
? {
|
|
3435
|
+
? {
|
|
3436
|
+
node: (
|
|
3437
|
+
<Hosted
|
|
3438
|
+
render={renderPayer.sending}
|
|
3439
|
+
value={{ amount: payAmount, asset: scannedAssetUnits, recipient: payerRecipient, presence }}
|
|
3440
|
+
/>
|
|
3441
|
+
)
|
|
3442
|
+
}
|
|
3393
3443
|
: phase === 'send_qr' && paymentQr && renderPayer.showCode
|
|
3394
|
-
? {
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3444
|
+
? {
|
|
3445
|
+
node: (
|
|
3446
|
+
<Hosted
|
|
3447
|
+
render={renderPayer.showCode}
|
|
3448
|
+
value={{
|
|
3449
|
+
code: size => <PaymentQrDisplay frameQr={paymentQr} size={size} onError={onPaymentQrError} />,
|
|
3450
|
+
animated: paymentQrBlocks > 1,
|
|
3451
|
+
amount: payAmount,
|
|
3452
|
+
asset: scannedAssetUnits,
|
|
3453
|
+
recipient: payerRecipient,
|
|
3454
|
+
presence,
|
|
3455
|
+
notice: notice ?? undefined,
|
|
3456
|
+
done: () => void completeQrDelivery(),
|
|
3457
|
+
back: () => void handleSendQrExit(false)
|
|
3458
|
+
}}
|
|
3459
|
+
/>
|
|
3460
|
+
)
|
|
3461
|
+
}
|
|
3405
3462
|
: phase === 'done' && renderPayer.done
|
|
3406
|
-
? {
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3463
|
+
? {
|
|
3464
|
+
node: (
|
|
3465
|
+
<Hosted
|
|
3466
|
+
render={renderPayer.done}
|
|
3467
|
+
value={{
|
|
3468
|
+
amount: settledAmount,
|
|
3469
|
+
amountText: settledTokenText ?? undefined,
|
|
3470
|
+
statusNote: settledStatusNote ?? undefined,
|
|
3471
|
+
recipientName:
|
|
3472
|
+
peerName ?? (scannedSession ? abbreviateKey(scannedSession.identityKey) : undefined),
|
|
3473
|
+
dismiss: () => {
|
|
3474
|
+
goBack()
|
|
3475
|
+
router.dismissTo(dismissTo)
|
|
3476
|
+
}
|
|
3477
|
+
}}
|
|
3478
|
+
/>
|
|
3479
|
+
)
|
|
3480
|
+
}
|
|
3417
3481
|
: null
|
|
3418
3482
|
|
|
3419
3483
|
return (
|
|
3420
3484
|
<View
|
|
3421
3485
|
style={
|
|
3422
|
-
hosted
|
|
3486
|
+
hosted
|
|
3487
|
+
? styles.container
|
|
3488
|
+
: embedded
|
|
3489
|
+
? undefined
|
|
3490
|
+
: [styles.container, { backgroundColor: colors.backgroundSecondary }]
|
|
3423
3491
|
}
|
|
3424
3492
|
>
|
|
3425
3493
|
{hosted ? (
|