Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron committed Sep 17, 2024
1 parent cb5c099 commit ac12662
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion components/DualCurrencyInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ export function DualCurrencyInput({
const styles = StyleSheet.create({
amountInput: {
fontSize: 80,
height: 100,
height: 90,
},
});
2 changes: 1 addition & 1 deletion components/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function QRCodeScanner({ onScanned, startScanning = true }: QRCodeScannerProps)

return (
<>
{isLoading && (
{isLoading || !isScanning && (
<View className="flex-1 justify-center items-center">
<Loading />
</View>
Expand Down
7 changes: 3 additions & 4 deletions hooks/useHandleLinking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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({
Expand Down
12 changes: 3 additions & 9 deletions pages/settings/wallets/WalletConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
};
Expand Down Expand Up @@ -152,7 +146,7 @@ export function WalletConnection() {
variant="destructive"
onPress={() => {
useAppStore.getState().removeNostrWalletConnectUrl();
scan();
setScanning(true);
}}
>
<Text>Disconnect Wallet</Text>
Expand All @@ -173,7 +167,7 @@ export function WalletConnection() {
)}
{!isConnecting && (
<>
<QRCodeScanner onScanned={handleScanned} />
<QRCodeScanner onScanned={handleScanned} startScanning={isScanning} />
<View className="flex flex-row items-stretch justify-center gap-4 p-6">
<Button
onPress={paste}
Expand Down

0 comments on commit ac12662

Please sign in to comment.