From ac12662d5a58d4cc1a24b460b92cd6e80c6cf88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Aaron?= Date: Tue, 17 Sep 2024 20:26:46 +0200 Subject: [PATCH] fix: cleanup --- components/DualCurrencyInput.tsx | 2 +- components/QRCodeScanner.tsx | 2 +- hooks/useHandleLinking.ts | 7 +++---- pages/settings/wallets/WalletConnection.tsx | 12 +++--------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/components/DualCurrencyInput.tsx b/components/DualCurrencyInput.tsx index 373524e..b18958d 100644 --- a/components/DualCurrencyInput.tsx +++ b/components/DualCurrencyInput.tsx @@ -82,6 +82,6 @@ export function DualCurrencyInput({ const styles = StyleSheet.create({ amountInput: { fontSize: 80, - height: 100, + height: 90, }, }); diff --git a/components/QRCodeScanner.tsx b/components/QRCodeScanner.tsx index 7895ea8..de8ff6a 100644 --- a/components/QRCodeScanner.tsx +++ b/components/QRCodeScanner.tsx @@ -48,7 +48,7 @@ function QRCodeScanner({ onScanned, startScanning = true }: QRCodeScannerProps) return ( <> - {isLoading && ( + {isLoading || !isScanning && ( diff --git a/hooks/useHandleLinking.ts b/hooks/useHandleLinking.ts index 9a89f3f..bd9c2ee 100644 --- a/hooks/useHandleLinking.ts +++ b/hooks/useHandleLinking.ts @@ -2,6 +2,7 @@ import * as Linking from "expo-linking"; import { router, useRootNavigationState } from "expo-router"; import React from "react"; +// TODO: Remove exp:// const SUPPORTED_SCHEMES = ["lightning:", "bitcoin:", "alby:", "exp:"]; export function useHandleLinking() { @@ -14,16 +15,14 @@ export function useHandleLinking() { return; } - console.log("useHandleLinking", url); - for (const scheme of SUPPORTED_SCHEMES) { if (url.startsWith(scheme)) { let currentUrl = url.startsWith(scheme + "//") ? url.replace(scheme + "//", scheme) : url; - currentUrl = currentUrl.replace("exp:127.0.0.1:8081/--/", "lightning:"); - console.log("navigating to send screen", currentUrl); + // TODO: Remove, only for debugging purposes + currentUrl = currentUrl.replace("exp:127.0.0.1:8081/--/", "lightning:"); // Instead of dismissing all screens, we'll use replace to avoid navigation stack issues router.replace({ diff --git a/pages/settings/wallets/WalletConnection.tsx b/pages/settings/wallets/WalletConnection.tsx index 945eba4..f142d72 100644 --- a/pages/settings/wallets/WalletConnection.tsx +++ b/pages/settings/wallets/WalletConnection.tsx @@ -4,7 +4,6 @@ import * as Clipboard from "expo-clipboard"; import { nwc } from "@getalby/sdk"; import { ClipboardPaste, HelpCircle, X } from "~/components/Icons"; import { useAppStore } from "lib/state/appStore"; -import { Camera } from "expo-camera/legacy"; // TODO: check if Android camera detach bug is fixed and update camera import { router } from "expo-router"; import { Button } from "~/components/ui/button"; import { useInfo } from "~/hooks/useInfo"; @@ -22,16 +21,11 @@ export function WalletConnection() { const walletIdWithConnection = useAppStore((store) => store.wallets.findIndex((wallet) => wallet.nostrWalletConnectUrl), ); - const [isScanning, setScanning] = React.useState(false); const [isConnecting, setConnecting] = React.useState(false); + const [isScanning, setScanning] = React.useState(true); const { data: walletInfo } = useInfo(); const { data: balance } = useBalance(); - async function scan() { - const { status } = await Camera.requestCameraPermissionsAsync(); - setScanning(status === "granted"); - } - const handleScanned = (data: string) => { return connect(data); }; @@ -152,7 +146,7 @@ export function WalletConnection() { variant="destructive" onPress={() => { useAppStore.getState().removeNostrWalletConnectUrl(); - scan(); + setScanning(true); }} > Disconnect Wallet @@ -173,7 +167,7 @@ export function WalletConnection() { )} {!isConnecting && ( <> - +