From 1f494cdf941bc0640d07e165746eb7e4a12c4b80 Mon Sep 17 00:00:00 2001 From: minibits-cash Date: Fri, 28 Jun 2024 12:13:42 +0200 Subject: [PATCH] Support mints behind Tor with Orbot VPN, Add memo to payments to lightning address, Many fixes and UI improvements --- src/components/BottomModal.tsx | 2 +- src/components/Button.tsx | 19 +-- src/components/InfoModal.tsx | 3 +- src/components/Loading.tsx | 2 +- src/i18n_messages/en.json | 1 + .../PaymentRequests/OutgoingRequests.tsx | 89 ++----------- src/screens/TopupScreen.tsx | 3 +- src/screens/TranDetailScreen.tsx | 29 ++-- src/screens/TransferScreen.tsx | 70 ++++++---- src/screens/WalletScreen.tsx | 37 +----- src/services/walletService.ts | 125 ++++++------------ src/theme/colors.ts | 42 +++++- 12 files changed, 162 insertions(+), 260 deletions(-) diff --git a/src/components/BottomModal.tsx b/src/components/BottomModal.tsx index d2b035d3..b3c413ab 100644 --- a/src/components/BottomModal.tsx +++ b/src/components/BottomModal.tsx @@ -110,7 +110,7 @@ export function BottomModal(props: ModalProps) { isVisible = true, onBackdropPress, onBackButtonPress, - backdropOpacity = 0.25, + backdropOpacity = 0.4, content, contentTx, contentTxOptions, diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 34ecacc9..5bc29228 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -92,8 +92,17 @@ export function Button(props: ButtonProps) { const textColor = useThemeColor("text") const defaultBg = useThemeColor("button") - const secondaryBg = useThemeColor("background") - const tertiaryBg = "transparent" + const defaultBgPressed = useThemeColor("buttonPressed") + const secondaryBg = useThemeColor("buttonSecondary") + const secondaryBgPressed = useThemeColor("buttonSecondaryPressed") + const tertiaryBg = useThemeColor("buttonTertiary") + const tertiaryBgPressed = useThemeColor("buttonTertiaryPressed") + + const $pressedViewPresets: Record> = { + default: { backgroundColor: defaultBgPressed }, + secondary: { backgroundColor: secondaryBgPressed }, + tertiary: { backgroundColor: tertiaryBgPressed }, + } function $viewStyle({ pressed }) { return [ @@ -181,12 +190,6 @@ const $textPresets: Record> = { tertiary: $baseTextStyle, } -const $pressedViewPresets: Record> = { - default: { backgroundColor: colors.palette.success100 }, - secondary: { backgroundColor: colors.palette.neutral300 }, - tertiary: { backgroundColor: colors.palette.neutral200, opacity: 0.4 }, -} - const $pressedTextPresets: Record> = { default: { opacity: 0.9 }, secondary: { opacity: 0.9 }, diff --git a/src/components/InfoModal.tsx b/src/components/InfoModal.tsx index 9f5a80d7..6719974c 100644 --- a/src/components/InfoModal.tsx +++ b/src/components/InfoModal.tsx @@ -24,6 +24,7 @@ export const InfoModal: FC = function ({ message }) { } const backgroundColor = useThemeColor('info') + const iconColor = useThemeColor('textDim') return ( = function ({ message }) { onBackButtonPress={() => onClose()} ContentComponent={ - + {message} } diff --git a/src/components/Loading.tsx b/src/components/Loading.tsx index 4c62dd5a..6b5327e9 100644 --- a/src/components/Loading.tsx +++ b/src/components/Loading.tsx @@ -18,7 +18,7 @@ const $loading = (bg: ColorValue, shiftedUp = false) => ({ alignItems: 'center', justifyContent: 'center', backgroundColor: bg, - opacity: 0.5, + opacity: 0.25, zIndex: 9999, // for cards that go up in the header, the loading should cover them marginTop: shiftedUp ? -(spacing.extraLarge * 2 + spacing.small) : 0, diff --git a/src/i18n_messages/en.json b/src/i18n_messages/en.json index 928ab294..9f153bbf 100644 --- a/src/i18n_messages/en.json +++ b/src/i18n_messages/en.json @@ -463,6 +463,7 @@ "balanceAfter": "Balance after this transaction", "claim": "Claim", "createdAt": "Created at", + "expiresAt": "Expires at", "id": "ID", "invoice": "Lightning invoice to pay", "isOffline": "Redeem online", diff --git a/src/screens/PaymentRequests/OutgoingRequests.tsx b/src/screens/PaymentRequests/OutgoingRequests.tsx index afc4c6c0..7a286ed9 100644 --- a/src/screens/PaymentRequests/OutgoingRequests.tsx +++ b/src/screens/PaymentRequests/OutgoingRequests.tsx @@ -30,6 +30,7 @@ import QRCode from 'react-native-qrcode-svg' import { infoMessage } from '../../utils/utils' import Clipboard from '@react-native-clipboard/clipboard' import { translate } from '../../i18n' +import { QRCodeBlock } from '../Wallet/QRCode' export const OutgoingRequests = observer(function (props: { @@ -66,35 +67,6 @@ export const OutgoingRequests = observer(function (props: { } - const onShareToApp = async () => { - try { - const result = await Share.share({ - message: selectedRequest?.encodedInvoice as string, - }) - - if (result.action === Share.sharedAction) { - setTimeout( - () => infoMessage(translate("lightningInvoiceSharedWaiting")), - 500, - ) - } else if (result.action === Share.dismissedAction) { - infoMessage(translate("share.cancelled")) - } - } catch (e: any) { - handleError(e) - } - } - - - const onCopy = function () { - try { - Clipboard.setString(selectedRequest?.encodedInvoice as string) - } catch (e: any) { - setInfo(translate('common.copyFailParam', { param: e.message })) - } - } - - const handleError = function (e: AppError): void { setIsLoading(false) setError(e) @@ -132,78 +104,33 @@ export const OutgoingRequests = observer(function (props: { contentStyle={{color: hintColor, padding: spacing.small}} style={$card} /> - )} - {isLoading && } + )} + } onBackButtonPress={toggleQRModal} onBackdropPress={toggleQRModal} /> {error && } {info && } + {isLoading && } ) }, ) -const ShareAsQRCodeBlock = observer(function (props: { - toggleQRModal: any - invoiceToPay: string - onShareToApp: any - onCopy: any - onError: any - }) { - return ( - - - - - - -