diff --git a/components/ui/card.tsx b/components/ui/card.tsx index b657d66..87cb6a4 100644 --- a/components/ui/card.tsx +++ b/components/ui/card.tsx @@ -56,7 +56,7 @@ const CardDescription = React.forwardRef< >(({ className, ...props }, ref) => ( )); diff --git a/pages/settings/wallets/EditWallet.tsx b/pages/settings/wallets/EditWallet.tsx index b56abf9..a70a2b1 100644 --- a/pages/settings/wallets/EditWallet.tsx +++ b/pages/settings/wallets/EditWallet.tsx @@ -1,8 +1,7 @@ import { Link, router } from "expo-router"; -import { Alert, Pressable, Text, View } from "react-native"; +import { Alert, Pressable, View } from "react-native"; import Toast from "react-native-toast-message"; -import { Nip47Capability } from "@getalby/sdk/dist/NWCClient"; import * as Clipboard from "expo-clipboard"; import { ArchiveRestore, @@ -18,30 +17,35 @@ import { CardDescription, CardTitle, } from "~/components/ui/card"; -import { DEFAULT_WALLET_NAME } from "~/lib/constants"; +import { DEFAULT_WALLET_NAME, REQUIRED_CAPABILITIES } from "~/lib/constants"; import { useAppStore } from "~/lib/state/appStore"; export function EditWallet() { const selectedWalletId = useAppStore((store) => store.selectedWalletId); const wallets = useAppStore((store) => store.wallets); return ( - + - {(["notifications", "list_transactions"] as Nip47Capability[]).map( - (capability) => - (wallets[selectedWalletId].nwcCapabilities || []).indexOf( - capability, - ) < 0 && ( - - - - - Your wallet does not support {capability} - - - - ), - )} + {/* TODO: Do not allow notifications to be toggled without notifications capability */} + + + + + + This wallet might not work as expected + + + Missing capabilities:  + {REQUIRED_CAPABILITIES.filter( + (capability) => + !(wallets[selectedWalletId].nwcCapabilities || []).includes( + capability, + ), + ).join(", ")} + + + + diff --git a/pages/settings/wallets/SetupWallet.tsx b/pages/settings/wallets/SetupWallet.tsx index 2210a53..047c055 100644 --- a/pages/settings/wallets/SetupWallet.tsx +++ b/pages/settings/wallets/SetupWallet.tsx @@ -7,11 +7,22 @@ import React from "react"; import { Pressable, TouchableOpacity, View } from "react-native"; import Toast from "react-native-toast-message"; import DismissableKeyboardView from "~/components/DismissableKeyboardView"; -import { ClipboardPaste, HelpCircle, X } from "~/components/Icons"; +import { + ClipboardPaste, + HelpCircle, + TriangleAlert, + X, +} from "~/components/Icons"; import Loading from "~/components/Loading"; import QRCodeScanner from "~/components/QRCodeScanner"; import Screen from "~/components/Screen"; import { Button } from "~/components/ui/button"; +import { + Card, + CardContent, + CardDescription, + CardTitle, +} from "~/components/ui/card"; import { Dialog, DialogClose, @@ -73,18 +84,6 @@ export function SetupWallet() { if (info.notifications?.length) { capabilities.push("notifications"); } - if ( - !REQUIRED_CAPABILITIES.every((capability) => - capabilities.includes(capability), - ) - ) { - const missing = REQUIRED_CAPABILITIES.filter( - (capability) => !capabilities.includes(capability), - ); - throw new Error( - `Missing required capabilities: ${missing.join(", ")}`, - ); - } console.info("NWC connected", info); @@ -245,6 +244,27 @@ export function SetupWallet() { returnKeyType="done" /> + {capabilities && + !REQUIRED_CAPABILITIES.every((capability) => + capabilities.includes(capability), + ) && ( + + + + + + Alby Go might not work as expected + + + Missing capabilities:  + {REQUIRED_CAPABILITIES.filter( + (capability) => !capabilities.includes(capability), + ).join(", ")} + + + + + )}