From b72af5076ae0db86e805b7b357882284f57c9b4e Mon Sep 17 00:00:00 2001 From: Philipp Walter Date: Tue, 6 May 2025 11:45:47 +0200 Subject: [PATCH] feat(scan): add gift codes --- package.json | 2 +- src/navigation/types/index.ts | 4 + src/screens/Gift/Error.tsx | 82 ++++++++++++ src/screens/Gift/Loading.tsx | 187 +++++++++++++++++++++++++++ src/screens/Gift/Used.tsx | 92 +++++++++++++ src/sheets/BottomSheets.tsx | 2 + src/sheets/GiftNavigation.tsx | 65 ++++++++++ src/store/types/ui.ts | 1 + src/store/utils/lightning.ts | 5 +- src/utils/blocktank/index.ts | 42 +++++- src/utils/i18n/locales/en/other.json | 32 +++++ src/utils/scanner/scanner.ts | 16 +++ src/utils/scanner/types.ts | 10 +- yarn.lock | 10 +- 14 files changed, 536 insertions(+), 14 deletions(-) create mode 100644 src/screens/Gift/Error.tsx create mode 100644 src/screens/Gift/Loading.tsx create mode 100644 src/screens/Gift/Used.tsx create mode 100644 src/sheets/GiftNavigation.tsx diff --git a/package.json b/package.json index 2b82c0533..655de1144 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@react-navigation/native-stack": "7.2.0", "@reduxjs/toolkit": "2.2.6", "@shopify/react-native-skia": "next", - "@synonymdev/blocktank-lsp-http-client": "2.2.0", + "@synonymdev/blocktank-lsp-http-client": "2.5.0", "@synonymdev/react-native-ldk": "0.0.159", "@synonymdev/react-native-lnurl": "0.0.10", "@synonymdev/react-native-pubky": "^0.3.0", diff --git a/src/navigation/types/index.ts b/src/navigation/types/index.ts index a203f18f6..95e2f2bf8 100644 --- a/src/navigation/types/index.ts +++ b/src/navigation/types/index.ts @@ -9,6 +9,7 @@ import { import type { RecoveryStackParamList } from '../../screens/Recovery/RecoveryNavigator'; import type { BackupStackParamList } from '../../sheets/BackupNavigation'; +import type { GiftStackParamList } from '../../sheets/GiftNavigation'; import type { LNURLWithdrawStackParamList } from '../../sheets/LNURLWithdrawNavigation'; import type { OrangeTicketStackParamList } from '../../sheets/OrangeTicketNavigation'; import type { PinStackParamList } from '../../sheets/PINNavigation'; @@ -103,6 +104,9 @@ export type OrangeTicketScreenProps< T extends keyof OrangeTicketStackParamList, > = NativeStackScreenProps; +export type GiftScreenProps = + NativeStackScreenProps; + export type TreasureHuntScreenProps< T extends keyof TreasureHuntStackParamList, > = NativeStackScreenProps; diff --git a/src/screens/Gift/Error.tsx b/src/screens/Gift/Error.tsx new file mode 100644 index 000000000..177825080 --- /dev/null +++ b/src/screens/Gift/Error.tsx @@ -0,0 +1,82 @@ +import React, { ReactElement, memo } from 'react'; +import { useTranslation } from 'react-i18next'; +import { Image, StyleSheet, View } from 'react-native'; + +import BottomSheetNavigationHeader from '../../components/BottomSheetNavigationHeader'; +import GradientView from '../../components/GradientView'; +import SafeAreaInset from '../../components/SafeAreaInset'; +import Button from '../../components/buttons/Button'; +import { useSheetRef } from '../../sheets/SheetRefsProvider'; +import { BodyM } from '../../styles/text'; + +const imageSrc = require('../../assets/illustrations/exclamation-mark.png'); + +const ErrorScreen = (): ReactElement => { + const { t } = useTranslation('other'); + const sheetRef = useSheetRef('gift'); + + const onContinue = (): void => { + sheetRef.current?.close(); + }; + + return ( + + + + + {t('gift.error.text')} + + + + + + +