mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-12 02:08:22 +01:00
FIX: Removed some ts-ignores
This commit is contained in:
parent
034ddb1ac2
commit
ebb3ddac5b
10 changed files with 114 additions and 108 deletions
|
@ -7,7 +7,7 @@ import { useTheme } from './themes';
|
||||||
// Update the type for the props
|
// Update the type for the props
|
||||||
interface ListItemProps {
|
interface ListItemProps {
|
||||||
rightIcon?: any;
|
rightIcon?: any;
|
||||||
leftAvatar?: React.Component;
|
leftAvatar?: React.JSX.Element;
|
||||||
containerStyle?: object;
|
containerStyle?: object;
|
||||||
Component?: typeof React.Component | typeof PressableWrapper;
|
Component?: typeof React.Component | typeof PressableWrapper;
|
||||||
bottomDivider?: boolean;
|
bottomDivider?: boolean;
|
||||||
|
@ -27,6 +27,7 @@ interface ListItemProps {
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
chevron?: boolean;
|
chevron?: boolean;
|
||||||
checkmark?: boolean;
|
checkmark?: boolean;
|
||||||
|
subtitleProps?: object;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PressableWrapper extends React.Component<PressableProps> {
|
export class PressableWrapper extends React.Component<PressableProps> {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
|
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
import Clipboard from '@react-native-clipboard/clipboard';
|
import Clipboard from '@react-native-clipboard/clipboard';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
|
||||||
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
||||||
import { Linking, StyleSheet, View } from 'react-native';
|
import { Linking, StyleSheet, View } from 'react-native';
|
||||||
|
|
||||||
import { BlueStorageContext } from '../blue_modules/storage-context';
|
import { BlueStorageContext } from '../blue_modules/storage-context';
|
||||||
import Lnurl from '../class/lnurl';
|
import Lnurl from '../class/lnurl';
|
||||||
import { LightningTransaction, Transaction } from '../class/wallets/types';
|
import { LightningTransaction, Transaction } from '../class/wallets/types';
|
||||||
|
@ -16,12 +14,14 @@ import TransactionOutgoingIcon from '../components/icons/TransactionOutgoingIcon
|
||||||
import TransactionPendingIcon from '../components/icons/TransactionPendingIcon';
|
import TransactionPendingIcon from '../components/icons/TransactionPendingIcon';
|
||||||
import loc, { formatBalanceWithoutSuffix, transactionTimeToReadable } from '../loc';
|
import loc, { formatBalanceWithoutSuffix, transactionTimeToReadable } from '../loc';
|
||||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||||
import * as NavigationService from '../NavigationService';
|
|
||||||
import { useSettings } from './Context/SettingsContext';
|
import { useSettings } from './Context/SettingsContext';
|
||||||
import ListItem from './ListItem';
|
import ListItem from './ListItem';
|
||||||
import { useTheme } from './themes';
|
import { useTheme } from './themes';
|
||||||
import ToolTipMenu from './TooltipMenu';
|
import ToolTipMenu from './TooltipMenu';
|
||||||
import { Action } from './types';
|
import { Action, ToolTipMenuProps } from './types';
|
||||||
|
import { useExtendedNavigation } from '../hooks/useExtendedNavigation';
|
||||||
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||||
|
import { DetailViewStackParamList } from '../navigation/DetailViewStackParamList';
|
||||||
|
|
||||||
interface TransactionListItemProps {
|
interface TransactionListItemProps {
|
||||||
itemPriceUnit: BitcoinUnit;
|
itemPriceUnit: BitcoinUnit;
|
||||||
|
@ -29,11 +29,13 @@ interface TransactionListItemProps {
|
||||||
item: Transaction & LightningTransaction; // using type intersection to have less issues with ts
|
item: Transaction & LightningTransaction; // using type intersection to have less issues with ts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NavigationProps = NativeStackNavigationProp<DetailViewStackParamList>;
|
||||||
|
|
||||||
export const TransactionListItem: React.FC<TransactionListItemProps> = React.memo(({ item, itemPriceUnit = BitcoinUnit.BTC, walletID }) => {
|
export const TransactionListItem: React.FC<TransactionListItemProps> = React.memo(({ item, itemPriceUnit = BitcoinUnit.BTC, walletID }) => {
|
||||||
const [subtitleNumberOfLines, setSubtitleNumberOfLines] = useState(1);
|
const [subtitleNumberOfLines, setSubtitleNumberOfLines] = useState(1);
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
const { navigate } = useNavigation();
|
const { navigate } = useExtendedNavigation<NavigationProps>();
|
||||||
const menuRef = useRef();
|
const menuRef = useRef<ToolTipMenuProps>();
|
||||||
const { txMetadata, counterpartyMetadata, wallets } = useContext(BlueStorageContext);
|
const { txMetadata, counterpartyMetadata, wallets } = useContext(BlueStorageContext);
|
||||||
const { preferredFiatCurrency, language } = useSettings();
|
const { preferredFiatCurrency, language } = useSettings();
|
||||||
const containerStyle = useMemo(
|
const containerStyle = useMemo(
|
||||||
|
@ -200,10 +202,8 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = React.mem
|
||||||
}, [subtitle]);
|
}, [subtitle]);
|
||||||
|
|
||||||
const onPress = useCallback(async () => {
|
const onPress = useCallback(async () => {
|
||||||
// @ts-ignore: idk how to fix
|
|
||||||
menuRef?.current?.dismissMenu?.();
|
menuRef?.current?.dismissMenu?.();
|
||||||
if (item.hash) {
|
if (item.hash) {
|
||||||
// @ts-ignore: idk how to fix
|
|
||||||
navigate('TransactionStatus', { hash: item.hash, walletID });
|
navigate('TransactionStatus', { hash: item.hash, walletID });
|
||||||
} else if (item.type === 'user_invoice' || item.type === 'payment_request' || item.type === 'paid_invoice') {
|
} else if (item.type === 'user_invoice' || item.type === 'payment_request' || item.type === 'paid_invoice') {
|
||||||
const lightningWallet = wallets.filter(wallet => wallet?.getID() === item.walletID);
|
const lightningWallet = wallets.filter(wallet => wallet?.getID() === item.walletID);
|
||||||
|
@ -217,8 +217,7 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = React.mem
|
||||||
}
|
}
|
||||||
const loaded = await LN.loadSuccessfulPayment(paymentHash);
|
const loaded = await LN.loadSuccessfulPayment(paymentHash);
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
NavigationService.navigate('ScanLndInvoiceRoot', {
|
navigate('ScanLndInvoiceRoot', {
|
||||||
// @ts-ignore: idk how to fix
|
|
||||||
screen: 'LnurlPaySuccess',
|
screen: 'LnurlPaySuccess',
|
||||||
params: {
|
params: {
|
||||||
paymentHash,
|
paymentHash,
|
||||||
|
@ -232,7 +231,6 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = React.mem
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore: idk how to fix
|
|
||||||
navigate('LNDViewInvoice', {
|
navigate('LNDViewInvoice', {
|
||||||
invoice: item,
|
invoice: item,
|
||||||
walletID: lightningWallet[0].getID(),
|
walletID: lightningWallet[0].getID(),
|
||||||
|
@ -347,7 +345,6 @@ export const TransactionListItem: React.FC<TransactionListItemProps> = React.mem
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<ToolTipMenu ref={menuRef} actions={toolTipActions} onPressMenuItem={onToolTipPress} onPress={onPress}>
|
<ToolTipMenu ref={menuRef} actions={toolTipActions} onPressMenuItem={onToolTipPress} onPress={onPress}>
|
||||||
<ListItem
|
<ListItem
|
||||||
// @ts-ignore wtf
|
|
||||||
leftAvatar={avatar}
|
leftAvatar={avatar}
|
||||||
title={title}
|
title={title}
|
||||||
subtitleNumberOfLines={subtitleNumberOfLines}
|
subtitleNumberOfLines={subtitleNumberOfLines}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { FiatUnit } from '../models/fiatUnit';
|
||||||
import { BlurredBalanceView } from './BlurredBalanceView';
|
import { BlurredBalanceView } from './BlurredBalanceView';
|
||||||
import { useSettings } from './Context/SettingsContext';
|
import { useSettings } from './Context/SettingsContext';
|
||||||
import ToolTipMenu from './TooltipMenu';
|
import ToolTipMenu from './TooltipMenu';
|
||||||
|
import { ToolTipMenuProps } from './types';
|
||||||
|
|
||||||
interface TransactionsNavigationHeaderProps {
|
interface TransactionsNavigationHeaderProps {
|
||||||
wallet: TWallet;
|
wallet: TWallet;
|
||||||
|
@ -31,22 +32,17 @@ interface TransactionsNavigationHeaderProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps> = ({
|
const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps> = ({
|
||||||
// @ts-ignore: Ugh
|
|
||||||
wallet: initialWallet,
|
wallet: initialWallet,
|
||||||
// @ts-ignore: Ugh
|
|
||||||
onWalletUnitChange,
|
onWalletUnitChange,
|
||||||
// @ts-ignore: Ugh
|
|
||||||
navigation,
|
navigation,
|
||||||
// @ts-ignore: Ugh
|
|
||||||
onManageFundsPressed,
|
onManageFundsPressed,
|
||||||
// @ts-ignore: Ugh
|
|
||||||
onWalletBalanceVisibilityChange,
|
onWalletBalanceVisibilityChange,
|
||||||
}) => {
|
}) => {
|
||||||
const [wallet, setWallet] = useState(initialWallet);
|
const [wallet, setWallet] = useState(initialWallet);
|
||||||
const [allowOnchainAddress, setAllowOnchainAddress] = useState(false);
|
const [allowOnchainAddress, setAllowOnchainAddress] = useState(false);
|
||||||
const { preferredFiatCurrency } = useSettings();
|
const { preferredFiatCurrency } = useSettings();
|
||||||
|
|
||||||
const menuRef = useRef(null);
|
const menuRef = useRef<ToolTipMenuProps>(null);
|
||||||
|
|
||||||
const verifyIfWalletAllowsOnchainAddress = useCallback(() => {
|
const verifyIfWalletAllowsOnchainAddress = useCallback(() => {
|
||||||
if (wallet.type === LightningCustodianWallet.type) {
|
if (wallet.type === LightningCustodianWallet.type) {
|
||||||
|
@ -85,8 +81,9 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeWalletBalanceUnit = () => {
|
const changeWalletBalanceUnit = () => {
|
||||||
// @ts-ignore: Ugh
|
if (menuRef.current?.dismissMenu) {
|
||||||
menuRef.current?.dismissMenu();
|
menuRef.current.dismissMenu();
|
||||||
|
}
|
||||||
let newWalletPreferredUnit = wallet.getPreferredBalanceUnit();
|
let newWalletPreferredUnit = wallet.getPreferredBalanceUnit();
|
||||||
|
|
||||||
if (newWalletPreferredUnit === BitcoinUnit.BTC) {
|
if (newWalletPreferredUnit === BitcoinUnit.BTC) {
|
||||||
|
@ -140,7 +137,6 @@ const TransactionsNavigationHeader: React.FC<TransactionsNavigationHeaderProps>
|
||||||
<LinearGradient
|
<LinearGradient
|
||||||
colors={WalletGradient.gradientsFor(wallet.type)}
|
colors={WalletGradient.gradientsFor(wallet.type)}
|
||||||
style={styles.lineaderGradient}
|
style={styles.lineaderGradient}
|
||||||
// @ts-ignore: Ugh
|
|
||||||
{...WalletGradient.linearGradientProps(wallet.type)}
|
{...WalletGradient.linearGradientProps(wallet.type)}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
|
import React, { useMemo, useRef } from 'react';
|
||||||
import Clipboard from '@react-native-clipboard/clipboard';
|
import Clipboard from '@react-native-clipboard/clipboard';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import React, { useMemo, useRef } from 'react';
|
|
||||||
import { StyleSheet, Text, View } from 'react-native';
|
import { StyleSheet, Text, View } from 'react-native';
|
||||||
import { ListItem } from 'react-native-elements';
|
import { ListItem } from 'react-native-elements';
|
||||||
import Share from 'react-native-share';
|
import Share from 'react-native-share';
|
||||||
|
|
||||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||||
import { useStorage } from '../../blue_modules/storage-context';
|
import { useStorage } from '../../blue_modules/storage-context';
|
||||||
import confirm from '../../helpers/confirm';
|
import confirm from '../../helpers/confirm';
|
||||||
|
@ -15,8 +14,10 @@ import presentAlert from '../Alert';
|
||||||
import QRCodeComponent from '../QRCodeComponent';
|
import QRCodeComponent from '../QRCodeComponent';
|
||||||
import { useTheme } from '../themes';
|
import { useTheme } from '../themes';
|
||||||
import TooltipMenu from '../TooltipMenu';
|
import TooltipMenu from '../TooltipMenu';
|
||||||
import { Action } from '../types';
|
import { Action, ToolTipMenuProps } from '../types';
|
||||||
import { AddressTypeBadge } from './AddressTypeBadge';
|
import { AddressTypeBadge } from './AddressTypeBadge';
|
||||||
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||||
|
import { DetailViewStackParamList } from '../../navigation/DetailViewStackParamList';
|
||||||
|
|
||||||
interface AddressItemProps {
|
interface AddressItemProps {
|
||||||
// todo: fix `any` after addresses.js is converted to the church of holy typescript
|
// todo: fix `any` after addresses.js is converted to the church of holy typescript
|
||||||
|
@ -26,6 +27,8 @@ interface AddressItemProps {
|
||||||
allowSignVerifyMessage: boolean;
|
allowSignVerifyMessage: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NavigationProps = NativeStackNavigationProp<DetailViewStackParamList>;
|
||||||
|
|
||||||
const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }: AddressItemProps) => {
|
const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }: AddressItemProps) => {
|
||||||
const { wallets } = useStorage();
|
const { wallets } = useStorage();
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
|
@ -52,13 +55,18 @@ const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }: Ad
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { navigate } = useNavigation();
|
const { navigate } = useNavigation<NavigationProps>();
|
||||||
|
|
||||||
|
const menuRef = useRef<ToolTipMenuProps>();
|
||||||
|
|
||||||
|
const dismissMenu = () => {
|
||||||
|
if (menuRef.current?.dismissMenu) {
|
||||||
|
menuRef.current.dismissMenu();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const menuRef = useRef();
|
|
||||||
const navigateToReceive = () => {
|
const navigateToReceive = () => {
|
||||||
// @ts-ignore wtf
|
dismissMenu();
|
||||||
menuRef.current?.dismissMenu();
|
|
||||||
// @ts-ignore wtf
|
|
||||||
navigate('ReceiveDetailsRoot', {
|
navigate('ReceiveDetailsRoot', {
|
||||||
screen: 'ReceiveDetails',
|
screen: 'ReceiveDetails',
|
||||||
params: {
|
params: {
|
||||||
|
@ -69,9 +77,7 @@ const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }: Ad
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToSignVerify = () => {
|
const navigateToSignVerify = () => {
|
||||||
// @ts-ignore wtf
|
dismissMenu();
|
||||||
menuRef.current?.dismissMenu();
|
|
||||||
// @ts-ignore wtf
|
|
||||||
navigate('SignVerifyRoot', {
|
navigate('SignVerifyRoot', {
|
||||||
screen: 'SignVerify',
|
screen: 'SignVerify',
|
||||||
params: {
|
params: {
|
||||||
|
@ -114,13 +120,13 @@ const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }: Ad
|
||||||
};
|
};
|
||||||
|
|
||||||
const onToolTipPress = async (id: string) => {
|
const onToolTipPress = async (id: string) => {
|
||||||
if (id === AddressItem.actionKeys.CopyToClipboard) {
|
if (id === actionKeys.CopyToClipboard) {
|
||||||
handleCopyPress();
|
handleCopyPress();
|
||||||
} else if (id === AddressItem.actionKeys.Share) {
|
} else if (id === actionKeys.Share) {
|
||||||
handleSharePress();
|
handleSharePress();
|
||||||
} else if (id === AddressItem.actionKeys.SignVerify) {
|
} else if (id === actionKeys.SignVerify) {
|
||||||
navigateToSignVerify();
|
navigateToSignVerify();
|
||||||
} else if (id === AddressItem.actionKeys.ExportPrivateKey) {
|
} else if (id === actionKeys.ExportPrivateKey) {
|
||||||
if (await confirm(loc.addresses.sensitive_private_key)) {
|
if (await confirm(loc.addresses.sensitive_private_key)) {
|
||||||
if (await isBiometricUseCapableAndEnabled()) {
|
if (await isBiometricUseCapableAndEnabled()) {
|
||||||
if (!(await unlockWithBiometrics())) {
|
if (!(await unlockWithBiometrics())) {
|
||||||
|
@ -171,14 +177,14 @@ const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }: Ad
|
||||||
return render();
|
return render();
|
||||||
};
|
};
|
||||||
|
|
||||||
AddressItem.actionKeys = {
|
const actionKeys = {
|
||||||
Share: 'share',
|
Share: 'share',
|
||||||
CopyToClipboard: 'copyToClipboard',
|
CopyToClipboard: 'copyToClipboard',
|
||||||
SignVerify: 'signVerify',
|
SignVerify: 'signVerify',
|
||||||
ExportPrivateKey: 'exportPrivateKey',
|
ExportPrivateKey: 'exportPrivateKey',
|
||||||
};
|
};
|
||||||
|
|
||||||
AddressItem.actionIcons = {
|
const actionIcons = {
|
||||||
Signature: {
|
Signature: {
|
||||||
iconType: 'SYSTEM',
|
iconType: 'SYSTEM',
|
||||||
iconValue: 'signature',
|
iconValue: 'signature',
|
||||||
|
@ -220,30 +226,30 @@ const styles = StyleSheet.create({
|
||||||
const getAvailableActions = ({ allowSignVerifyMessage }: { allowSignVerifyMessage: boolean }): Action[] | Action[][] => {
|
const getAvailableActions = ({ allowSignVerifyMessage }: { allowSignVerifyMessage: boolean }): Action[] | Action[][] => {
|
||||||
const actions = [
|
const actions = [
|
||||||
{
|
{
|
||||||
id: AddressItem.actionKeys.CopyToClipboard,
|
id: actionKeys.CopyToClipboard,
|
||||||
text: loc.transactions.details_copy,
|
text: loc.transactions.details_copy,
|
||||||
icon: AddressItem.actionIcons.Clipboard,
|
icon: actionIcons.Clipboard,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: AddressItem.actionKeys.Share,
|
id: actionKeys.Share,
|
||||||
text: loc.receive.details_share,
|
text: loc.receive.details_share,
|
||||||
icon: AddressItem.actionIcons.Share,
|
icon: actionIcons.Share,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (allowSignVerifyMessage) {
|
if (allowSignVerifyMessage) {
|
||||||
actions.push({
|
actions.push({
|
||||||
id: AddressItem.actionKeys.SignVerify,
|
id: actionKeys.SignVerify,
|
||||||
text: loc.addresses.sign_title,
|
text: loc.addresses.sign_title,
|
||||||
icon: AddressItem.actionIcons.Signature,
|
icon: actionIcons.Signature,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allowSignVerifyMessage) {
|
if (allowSignVerifyMessage) {
|
||||||
actions.push({
|
actions.push({
|
||||||
id: AddressItem.actionKeys.ExportPrivateKey,
|
id: actionKeys.ExportPrivateKey,
|
||||||
text: loc.addresses.copy_private_key,
|
text: loc.addresses.copy_private_key,
|
||||||
icon: AddressItem.actionIcons.ExportPrivateKey,
|
icon: actionIcons.ExportPrivateKey,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ export interface ToolTipMenuProps {
|
||||||
actions: Action[] | Action[][];
|
actions: Action[] | Action[][];
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
enableAndroidRipple?: boolean;
|
enableAndroidRipple?: boolean;
|
||||||
|
dismissMenu?: () => void;
|
||||||
onPressMenuItem: (id: string) => void;
|
onPressMenuItem: (id: string) => void;
|
||||||
title?: string;
|
title?: string;
|
||||||
isMenuPrimaryAction?: boolean;
|
isMenuPrimaryAction?: boolean;
|
||||||
|
|
|
@ -359,19 +359,6 @@ const DetailViewStackScreensStack = () => {
|
||||||
presentation: 'fullScreenModal',
|
presentation: 'fullScreenModal',
|
||||||
statusBarHidden: true,
|
statusBarHidden: true,
|
||||||
}}
|
}}
|
||||||
initialParams={{
|
|
||||||
isLoading: false,
|
|
||||||
cameraStatusGranted: undefined,
|
|
||||||
backdoorPressed: undefined,
|
|
||||||
launchedBy: undefined,
|
|
||||||
urTotal: undefined,
|
|
||||||
urHave: undefined,
|
|
||||||
backdoorText: '',
|
|
||||||
onDismiss: undefined,
|
|
||||||
showFileImportButton: true,
|
|
||||||
backdoorVisible: false,
|
|
||||||
animatedQRCodeData: {},
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DetailViewRoot.Screen name="PaymentCodeRoot" component={PaymentCodeStackRoot} options={NavigationDefaultOptions} />
|
<DetailViewRoot.Screen name="PaymentCodeRoot" component={PaymentCodeStackRoot} options={NavigationDefaultOptions} />
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { LightningTransaction } from '../class/wallets/types';
|
||||||
|
|
||||||
export type DetailViewStackParamList = {
|
export type DetailViewStackParamList = {
|
||||||
WalletsList: undefined;
|
WalletsList: undefined;
|
||||||
WalletTransactions: { walletID: string; walletType: string };
|
WalletTransactions: { walletID: string; walletType: string };
|
||||||
|
@ -11,21 +13,32 @@ export type DetailViewStackParamList = {
|
||||||
RBFBumpFee: { transactionId: string };
|
RBFBumpFee: { transactionId: string };
|
||||||
RBFCancel: { transactionId: string };
|
RBFCancel: { transactionId: string };
|
||||||
SelectWallet: undefined;
|
SelectWallet: undefined;
|
||||||
LNDViewInvoice: { invoiceId: string };
|
LNDViewInvoice: { invoice: LightningTransaction; walletID: string };
|
||||||
LNDViewAdditionalInvoiceInformation: { invoiceId: string };
|
LNDViewAdditionalInvoiceInformation: { invoiceId: string };
|
||||||
LNDViewAdditionalInvoicePreImage: { invoiceId: string };
|
LNDViewAdditionalInvoicePreImage: { invoiceId: string };
|
||||||
Broadcast: undefined;
|
Broadcast: undefined;
|
||||||
IsItMyAddress: undefined;
|
IsItMyAddress: undefined;
|
||||||
GenerateWord: undefined;
|
GenerateWord: undefined;
|
||||||
LnurlPay: undefined;
|
LnurlPay: undefined;
|
||||||
LnurlPaySuccess: undefined;
|
LnurlPaySuccess: {
|
||||||
|
paymentHash: string;
|
||||||
|
justPaid: boolean;
|
||||||
|
fromWalletID: string;
|
||||||
|
};
|
||||||
LnurlAuth: undefined;
|
LnurlAuth: undefined;
|
||||||
Success: undefined;
|
Success: undefined;
|
||||||
WalletAddresses: { walletID: string };
|
WalletAddresses: { walletID: string };
|
||||||
AddWalletRoot: undefined;
|
AddWalletRoot: undefined;
|
||||||
SendDetailsRoot: undefined;
|
SendDetailsRoot: undefined;
|
||||||
LNDCreateInvoiceRoot: undefined;
|
LNDCreateInvoiceRoot: undefined;
|
||||||
ScanLndInvoiceRoot: undefined;
|
ScanLndInvoiceRoot: {
|
||||||
|
screen: string;
|
||||||
|
params: {
|
||||||
|
paymentHash: string;
|
||||||
|
fromWalletID: string;
|
||||||
|
justPaid: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
AztecoRedeemRoot: undefined;
|
AztecoRedeemRoot: undefined;
|
||||||
WalletExportRoot: undefined;
|
WalletExportRoot: undefined;
|
||||||
ExportMultisigCoordinationSetupRoot: undefined;
|
ExportMultisigCoordinationSetupRoot: undefined;
|
||||||
|
@ -40,7 +53,9 @@ export type DetailViewStackParamList = {
|
||||||
ElectrumSettings: undefined;
|
ElectrumSettings: undefined;
|
||||||
EncryptStorage: undefined;
|
EncryptStorage: undefined;
|
||||||
Language: undefined;
|
Language: undefined;
|
||||||
LightningSettings: undefined;
|
LightningSettings: {
|
||||||
|
url?: string;
|
||||||
|
};
|
||||||
NotificationSettings: undefined;
|
NotificationSettings: undefined;
|
||||||
SelfTest: undefined;
|
SelfTest: undefined;
|
||||||
ReleaseNotes: undefined;
|
ReleaseNotes: undefined;
|
||||||
|
@ -48,20 +63,35 @@ export type DetailViewStackParamList = {
|
||||||
SettingsPrivacy: undefined;
|
SettingsPrivacy: undefined;
|
||||||
ViewEditMultisigCosignersRoot: { walletID: string; cosigners: string[] };
|
ViewEditMultisigCosignersRoot: { walletID: string; cosigners: string[] };
|
||||||
WalletXpubRoot: undefined;
|
WalletXpubRoot: undefined;
|
||||||
SignVerifyRoot: undefined;
|
SignVerifyRoot: {
|
||||||
ReceiveDetailsRoot: undefined;
|
screen: 'SignVerify';
|
||||||
|
params: {
|
||||||
|
walletID: string;
|
||||||
|
address: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
ReceiveDetailsRoot: {
|
||||||
|
screen: 'ReceiveDetails';
|
||||||
|
params: {
|
||||||
|
walletID: string;
|
||||||
|
address: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
ScanQRCodeRoot: {
|
ScanQRCodeRoot: {
|
||||||
isLoading?: boolean;
|
screen: string;
|
||||||
cameraStatusGranted?: boolean;
|
params: {
|
||||||
backdoorPressed?: boolean;
|
isLoading: false;
|
||||||
launchedBy?: string;
|
cameraStatusGranted?: boolean;
|
||||||
urTotal?: number;
|
backdoorPressed?: boolean;
|
||||||
urHave?: number;
|
launchedBy?: string;
|
||||||
backdoorText?: string;
|
urTotal?: number;
|
||||||
onDismiss?: () => void;
|
urHave?: number;
|
||||||
showFileImportButton?: boolean;
|
backdoorText?: string;
|
||||||
backdoorVisible?: boolean;
|
onDismiss?: () => void;
|
||||||
animatedQRCodeData?: Record<string, any>;
|
showFileImportButton: true;
|
||||||
|
backdoorVisible?: boolean;
|
||||||
|
animatedQRCodeData?: Record<string, any>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
PaymentCodeRoot: undefined;
|
PaymentCodeRoot: undefined;
|
||||||
ReorderWallets: undefined;
|
ReorderWallets: undefined;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
||||||
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
|
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
|
import { RouteProp, useRoute } from '@react-navigation/native';
|
||||||
import { Alert, I18nManager, Linking, ScrollView, StyleSheet, TextInput, View } from 'react-native';
|
import { Alert, I18nManager, Linking, ScrollView, StyleSheet, TextInput, View } from 'react-native';
|
||||||
import { Button as ButtonRNElements } from 'react-native-elements';
|
import { Button as ButtonRNElements } from 'react-native-elements';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import { LightningCustodianWallet } from '../../class/wallets/lightning-custodia
|
||||||
import presentAlert from '../../components/Alert';
|
import presentAlert from '../../components/Alert';
|
||||||
import { Button } from '../../components/Button';
|
import { Button } from '../../components/Button';
|
||||||
import { useTheme } from '../../components/themes';
|
import { useTheme } from '../../components/themes';
|
||||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
import { scanQrHelper } from '../../helpers/scan-qr';
|
||||||
import loc from '../../loc';
|
import loc from '../../loc';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
@ -52,7 +52,6 @@ const LightningSettings: React.FC = () => {
|
||||||
const [URI, setURI] = useState<string>();
|
const [URI, setURI] = useState<string>();
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const navigation = useNavigation();
|
|
||||||
const styleHook = StyleSheet.create({
|
const styleHook = StyleSheet.create({
|
||||||
uri: {
|
uri: {
|
||||||
borderColor: colors.formBorder,
|
borderColor: colors.formBorder,
|
||||||
|
@ -114,17 +113,11 @@ const LightningSettings: React.FC = () => {
|
||||||
}, [URI]);
|
}, [URI]);
|
||||||
|
|
||||||
const importScan = () => {
|
const importScan = () => {
|
||||||
requestCameraAuthorization().then(() =>
|
scanQrHelper(route.name).then(data => {
|
||||||
// @ts-ignore: Address types later
|
if (data) {
|
||||||
navigation.navigate('ScanQRCodeRoot', {
|
setLndhubURI(data);
|
||||||
screen: 'ScanQRCode',
|
}
|
||||||
params: {
|
});
|
||||||
launchedBy: route.name,
|
|
||||||
onBarScanned: setLndhubURI,
|
|
||||||
showFileImportButton: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import Clipboard from '@react-native-clipboard/clipboard';
|
import Clipboard from '@react-native-clipboard/clipboard';
|
||||||
import { RouteProp, useFocusEffect, useNavigation, useRoute } from '@react-navigation/native';
|
import { RouteProp, useFocusEffect, useRoute } from '@react-navigation/native';
|
||||||
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
@ -18,6 +18,8 @@ import navigationStyle from '../../components/navigationStyle';
|
||||||
import { useTheme } from '../../components/themes';
|
import { useTheme } from '../../components/themes';
|
||||||
import ToolTipMenu from '../../components/TooltipMenu';
|
import ToolTipMenu from '../../components/TooltipMenu';
|
||||||
import loc from '../../loc';
|
import loc from '../../loc';
|
||||||
|
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
|
||||||
|
import { DetailViewStackParamList } from '../../navigation/DetailViewStackParamList';
|
||||||
|
|
||||||
interface TransactionDetailsProps {
|
interface TransactionDetailsProps {
|
||||||
route: RouteProp<{ params: { hash: string; walletID: string } }, 'params'>;
|
route: RouteProp<{ params: { hash: string; walletID: string } }, 'params'>;
|
||||||
|
@ -62,8 +64,10 @@ const toolTipMenuActions = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
type NavigationProps = NativeStackNavigationProp<DetailViewStackParamList, 'TransactionDetails'>;
|
||||||
|
|
||||||
const TransactionDetails = () => {
|
const TransactionDetails = () => {
|
||||||
const { setOptions, navigate } = useNavigation();
|
const { setOptions, navigate } = useExtendedNavigation<NavigationProps>();
|
||||||
const { hash, walletID } = useRoute<TransactionDetailsProps['route']>().params;
|
const { hash, walletID } = useRoute<TransactionDetailsProps['route']>().params;
|
||||||
const { saveToDisk, txMetadata, counterpartyMetadata, wallets, getTransactions } = useContext(BlueStorageContext);
|
const { saveToDisk, txMetadata, counterpartyMetadata, wallets, getTransactions } = useContext(BlueStorageContext);
|
||||||
const [from, setFrom] = useState<string[]>([]);
|
const [from, setFrom] = useState<string[]>([]);
|
||||||
|
@ -204,7 +208,6 @@ const TransactionDetails = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToWallet = (wallet: TWallet) => {
|
const navigateToWallet = (wallet: TWallet) => {
|
||||||
// @ts-ignore idk how to fix it
|
|
||||||
navigate('WalletTransactions', {
|
navigate('WalletTransactions', {
|
||||||
walletID: wallet.getID(),
|
walletID: wallet.getID(),
|
||||||
walletType: wallet.type,
|
walletType: wallet.type,
|
||||||
|
|
|
@ -18,7 +18,7 @@ import {
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { Badge, Icon } from 'react-native-elements';
|
import { Badge, Icon } from 'react-native-elements';
|
||||||
|
|
||||||
import { isDesktop } from '../../blue_modules/environment';
|
import { isDesktop, isTablet } from '../../blue_modules/environment';
|
||||||
import { useStorage } from '../../blue_modules/storage-context';
|
import { useStorage } from '../../blue_modules/storage-context';
|
||||||
import { encodeUR } from '../../blue_modules/ur';
|
import { encodeUR } from '../../blue_modules/ur';
|
||||||
import {
|
import {
|
||||||
|
@ -191,7 +191,6 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
||||||
await wallet?.fetchBalance();
|
await wallet?.fetchBalance();
|
||||||
}
|
}
|
||||||
newWallets.push(wallet);
|
newWallets.push(wallet);
|
||||||
// @ts-ignore wtf
|
|
||||||
navigate('WalletsList');
|
navigate('WalletsList');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setWalletsWithNewOrder(newWallets);
|
setWalletsWithNewOrder(newWallets);
|
||||||
|
@ -529,11 +528,9 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderProvideMnemonicsModal = () => {
|
const renderProvideMnemonicsModal = () => {
|
||||||
// @ts-ignore weird, property exists on type definition. might be some ts bugs
|
|
||||||
const isPad: boolean = Platform.isPad;
|
|
||||||
return (
|
return (
|
||||||
<BottomModal avoidKeyboard isVisible={isProvideMnemonicsModalVisible} onClose={hideProvideMnemonicsModal} coverScreen={false}>
|
<BottomModal avoidKeyboard isVisible={isProvideMnemonicsModalVisible} onClose={hideProvideMnemonicsModal} coverScreen={false}>
|
||||||
<KeyboardAvoidingView enabled={!isPad} behavior={Platform.OS === 'ios' ? 'position' : 'padding'} keyboardVerticalOffset={120}>
|
<KeyboardAvoidingView enabled={!isTablet} behavior={Platform.OS === 'ios' ? 'position' : 'padding'} keyboardVerticalOffset={120}>
|
||||||
<View style={[styles.modalContent, stylesHook.modalContent]}>
|
<View style={[styles.modalContent, stylesHook.modalContent]}>
|
||||||
<BlueTextCentered>{loc.multisig.type_your_mnemonics}</BlueTextCentered>
|
<BlueTextCentered>{loc.multisig.type_your_mnemonics}</BlueTextCentered>
|
||||||
<BlueSpacing20 />
|
<BlueSpacing20 />
|
||||||
|
@ -561,12 +558,9 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderShareModal = () => {
|
const renderShareModal = () => {
|
||||||
// @ts-ignore weird, property exists on typedefinition. might be some ts bugs
|
|
||||||
const isPad: boolean = Platform.isPad;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BottomModal isVisible={isShareModalVisible} onClose={hideShareModal} doneButton coverScreen={false}>
|
<BottomModal isVisible={isShareModalVisible} onClose={hideShareModal} doneButton coverScreen={false}>
|
||||||
<KeyboardAvoidingView enabled={!isPad} behavior={Platform.OS === 'ios' ? 'position' : undefined}>
|
<KeyboardAvoidingView enabled={!isTablet} behavior={Platform.OS === 'ios' ? 'position' : undefined}>
|
||||||
<View style={[styles.modalContent, stylesHook.modalContent, styles.alignItemsCenter]}>
|
<View style={[styles.modalContent, stylesHook.modalContent, styles.alignItemsCenter]}>
|
||||||
<Text style={[styles.headerText, stylesHook.textDestination]}>
|
<Text style={[styles.headerText, stylesHook.textDestination]}>
|
||||||
{loc.multisig.this_is_cosigners_xpub} {Platform.OS === 'ios' ? loc.multisig.this_is_cosigners_xpub_airdrop : ''}
|
{loc.multisig.this_is_cosigners_xpub} {Platform.OS === 'ios' ? loc.multisig.this_is_cosigners_xpub_airdrop : ''}
|
||||||
|
@ -627,13 +621,11 @@ const ViewEditMultisigCosigners: React.FC = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const footer = <Button disabled={vaultKeyData.isLoading || isSaveButtonDisabled} title={loc._.save} onPress={onSave} />;
|
const footer = <Button disabled={vaultKeyData.isLoading || isSaveButtonDisabled} title={loc._.save} onPress={onSave} />;
|
||||||
// @ts-ignore weird, property exists on typedefinition. might be some ts bugs
|
|
||||||
const isPad: boolean = Platform.isPad;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.root, stylesHook.root]} ref={discardChangesRef}>
|
<View style={[styles.root, stylesHook.root]} ref={discardChangesRef}>
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
enabled={!isPad}
|
enabled={!isTablet}
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
keyboardVerticalOffset={62}
|
keyboardVerticalOffset={62}
|
||||||
style={[styles.mainBlock, styles.root]}
|
style={[styles.mainBlock, styles.root]}
|
||||||
|
|
Loading…
Add table
Reference in a new issue