mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-03 12:06:21 +01:00
ADD: Expand Alert component to add custom title
This commit is contained in:
parent
52848e0e16
commit
1116044c9f
47 changed files with 200 additions and 194 deletions
12
BlueApp.js
12
BlueApp.js
|
@ -24,7 +24,7 @@ import {
|
|||
SLIP39SegwitBech32Wallet,
|
||||
} from './class/';
|
||||
import { randomBytes } from './class/rng';
|
||||
import alert from './components/Alert';
|
||||
import presentAlert from './components/Alert';
|
||||
import { initCurrencyDaemon } from './blue_modules/currency';
|
||||
import DefaultPreference from 'react-native-default-preference';
|
||||
|
||||
|
@ -327,7 +327,7 @@ class AppStorage {
|
|||
try {
|
||||
realm = await this.getRealm();
|
||||
} catch (error) {
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
data = JSON.parse(data);
|
||||
if (!data.wallets) return false;
|
||||
|
@ -425,7 +425,7 @@ class AppStorage {
|
|||
try {
|
||||
if (realm) this.inflateWalletFromRealm(realm, unserializedWallet);
|
||||
} catch (error) {
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
|
||||
// done
|
||||
|
@ -581,7 +581,7 @@ class AppStorage {
|
|||
async saveToDisk() {
|
||||
if (savingInProgress) {
|
||||
console.warn('saveToDisk is in progress');
|
||||
if (++savingInProgress > 10) alert('Critical error. Last actions were not saved'); // should never happen
|
||||
if (++savingInProgress > 10) presentAlert({ message: 'Critical error. Last actions were not saved' }); // should never happen
|
||||
await new Promise(resolve => setTimeout(resolve, 1000 * savingInProgress)); // sleep
|
||||
return this.saveToDisk();
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ class AppStorage {
|
|||
try {
|
||||
realm = await this.getRealm();
|
||||
} catch (error) {
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
for (const key of this.wallets) {
|
||||
if (typeof key === 'boolean') continue;
|
||||
|
@ -667,7 +667,7 @@ class AppStorage {
|
|||
realmkeyValue.close();
|
||||
} catch (error) {
|
||||
console.error('save to disk exception:', error.message);
|
||||
alert('save to disk exception: ' + error.message);
|
||||
presentAlert({ message: 'save to disk exception: ' + error.message });
|
||||
if (error.message.includes('Realm file decryption failed')) {
|
||||
console.warn('purging realm key-value database file');
|
||||
this.purgeRealmKeyValueFile();
|
||||
|
|
|
@ -4,7 +4,7 @@ import { LegacyWallet, SegwitBech32Wallet, SegwitP2SHWallet, TaprootWallet } fro
|
|||
import DefaultPreference from 'react-native-default-preference';
|
||||
import loc from '../loc';
|
||||
import WidgetCommunication from './WidgetCommunication';
|
||||
import alert from '../components/Alert';
|
||||
import presentAlert from '../components/Alert';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const ElectrumClient = require('electrum-client');
|
||||
const reverse = require('buffer-reverse');
|
||||
|
@ -246,7 +246,7 @@ async function presentNetworkErrorAlert(usingPeer) {
|
|||
// Must be running on Android
|
||||
console.log(e);
|
||||
}
|
||||
alert(loc.settings.electrum_saved);
|
||||
presentAlert({ message: loc.settings.electrum_saved });
|
||||
setTimeout(connectMain, 500);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ import loc from '../loc';
|
|||
import DocumentPicker from 'react-native-document-picker';
|
||||
import { launchImageLibrary } from 'react-native-image-picker';
|
||||
import { isDesktop } from './environment';
|
||||
import alert from '../components/Alert';
|
||||
import presentAlert from '../components/Alert';
|
||||
import { readFile } from './react-native-bw-file-access';
|
||||
|
||||
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
|
||||
|
@ -16,7 +16,7 @@ const _shareOpen = async (filePath: string) => {
|
|||
saveToFiles: isDesktop,
|
||||
})
|
||||
.catch(error => {
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
console.log(error);
|
||||
})
|
||||
.finally(() => {
|
||||
|
@ -52,7 +52,7 @@ const writeFileAndExport = async function (filename: string, contents: string) {
|
|||
await _shareOpen(filePath);
|
||||
} catch (e: any) {
|
||||
console.log(e);
|
||||
alert(e.message);
|
||||
presentAlert({ message: e.message });
|
||||
}
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
|
@ -68,7 +68,7 @@ const writeFileAndExport = async function (filename: string, contents: string) {
|
|||
]);
|
||||
}
|
||||
} else {
|
||||
alert('Not implemented for this platform');
|
||||
presentAlert({ message: 'Not implemented for this platform' });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ const openSignedTransaction = async function (): Promise<string | boolean> {
|
|||
return await _readPsbtFileIntoBase64(res.uri);
|
||||
} catch (err) {
|
||||
if (!DocumentPicker.isCancel(err)) {
|
||||
alert(loc.send.details_no_signed_tx);
|
||||
presentAlert({ message: loc.send.details_no_signed_tx });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ const showFilePickerAndReadFile = async function (): Promise<{ data: string | fa
|
|||
});
|
||||
|
||||
if (!res.fileCopyUri) {
|
||||
alert('Picking and caching a file failed');
|
||||
presentAlert({ message: 'Picking and caching a file failed' });
|
||||
return { data: false, uri: false };
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ const showFilePickerAndReadFile = async function (): Promise<{ data: string | fa
|
|||
return new Promise(resolve => {
|
||||
if (!res.fileCopyUri) {
|
||||
// to make ts happy, should not need this check here
|
||||
alert('Picking and caching a file failed');
|
||||
presentAlert({ message: 'Picking and caching a file failed' });
|
||||
resolve({ data: false, uri: false });
|
||||
return;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ const showFilePickerAndReadFile = async function (): Promise<{ data: string | fa
|
|||
return { data: file, uri: fileCopyUri };
|
||||
} catch (err: any) {
|
||||
if (!DocumentPicker.isCancel(err)) {
|
||||
alert(err.message);
|
||||
presentAlert({ message: err.message });
|
||||
}
|
||||
return { data: false, uri: false };
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ const readFileOutsideSandbox = (filePath: string) => {
|
|||
} else if (Platform.OS === 'android') {
|
||||
return RNFS.readFile(filePath);
|
||||
} else {
|
||||
alert('Not implemented for this platform');
|
||||
presentAlert({ message: 'Not implemented for this platform' });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import React, { createContext, useEffect, useState } from 'react';
|
||||
import { Alert } from 'react-native';
|
||||
import { useAsyncStorage } from '@react-native-async-storage/async-storage';
|
||||
import { FiatUnit } from '../models/fiatUnit';
|
||||
import Notifications from '../blue_modules/notifications';
|
||||
import loc, { STORAGE_KEY as LOC_STORAGE_KEY } from '../loc';
|
||||
import { LegacyWallet, WatchOnlyWallet } from '../class';
|
||||
import alert from '../components/Alert';
|
||||
import presentAlert from '../components/Alert';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from './hapticFeedback';
|
||||
import { PREFERRED_CURRENCY_STORAGE_KEY } from './currency';
|
||||
const BlueApp = require('../BlueApp');
|
||||
|
@ -37,7 +36,7 @@ export const BlueStorageProvider = ({ children }) => {
|
|||
useEffect(() => {
|
||||
console.log(`Privacy blur: ${isPrivacyBlurEnabled}`);
|
||||
if (!isPrivacyBlurEnabled) {
|
||||
alert('Privacy blur has been disabled.');
|
||||
presentAlert({ message: 'Privacy blur has been disabled.' });
|
||||
}
|
||||
}, [isPrivacyBlurEnabled]);
|
||||
|
||||
|
@ -178,7 +177,7 @@ export const BlueStorageProvider = ({ children }) => {
|
|||
const addAndSaveWallet = async w => {
|
||||
if (wallets.some(i => i.getID() === w.getID())) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
Alert.alert('', 'This wallet has been previously imported.');
|
||||
presentAlert({ message: 'This wallet has been previously imported.' });
|
||||
return;
|
||||
}
|
||||
const emptyWalletLabel = new LegacyWallet().getLabel();
|
||||
|
@ -188,7 +187,7 @@ export const BlueStorageProvider = ({ children }) => {
|
|||
addWallet(w);
|
||||
await saveToDisk();
|
||||
A(A.ENUM.CREATED_WALLET);
|
||||
Alert.alert('', w.type === WatchOnlyWallet.type ? loc.wallets.import_success_watchonly : loc.wallets.import_success);
|
||||
presentAlert({ message: w.type === WatchOnlyWallet.type ? loc.wallets.import_success_watchonly : loc.wallets.import_success });
|
||||
Notifications.majorTomToGroundControl(w.getAllExternalAddresses(), [], []);
|
||||
// start balance fetching at the background
|
||||
await w.fetchBalance();
|
||||
|
|
|
@ -8,7 +8,7 @@ import RNSecureKeyStore from 'react-native-secure-key-store';
|
|||
import loc from '../loc';
|
||||
import { useContext } from 'react';
|
||||
import { BlueStorageContext } from '../blue_modules/storage-context';
|
||||
import alert from '../components/Alert';
|
||||
import presentAlert from '../components/Alert';
|
||||
|
||||
// Define a function type with properties
|
||||
type DescribableFunction = {
|
||||
|
@ -129,7 +129,7 @@ const Biometric: DescribableFunction = function () {
|
|||
isDevicePasscodeSupported = undefined;
|
||||
}
|
||||
if (isDevicePasscodeSupported === false) {
|
||||
alert(loc.settings.biom_no_passcode);
|
||||
presentAlert({ message: loc.settings.biom_no_passcode });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as bitcoin from 'bitcoinjs-lib';
|
||||
import alert from '../components/Alert';
|
||||
import presentAlert from '../components/Alert';
|
||||
import { ECPairFactory } from 'ecpair';
|
||||
import ecc from '../blue_modules/noble_ecc';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback';
|
||||
|
@ -75,7 +75,7 @@ export default class PayjoinTransaction {
|
|||
if (result === '') {
|
||||
// TODO: Improve the wording of this error message
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert('Something was wrong with the payjoin transaction, the original transaction sucessfully broadcast.');
|
||||
presentAlert({ message: 'Something was wrong with the payjoin transaction, the original transaction sucessfully broadcast.' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import * as bip39 from 'bip39';
|
|||
import { HDSegwitBech32Wallet } from './hd-segwit-bech32-wallet';
|
||||
import bolt11 from 'bolt11';
|
||||
import { SegwitBech32Wallet } from './segwit-bech32-wallet';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
export class LightningLdkWallet extends LightningCustodianWallet {
|
||||
|
@ -273,7 +273,7 @@ export class LightningLdkWallet extends LightningCustodianWallet {
|
|||
this._execInBackground(this.reestablishChannels);
|
||||
if (this.timeToCheckBlockchain()) this._execInBackground(this.checkBlockchain);
|
||||
} catch (error: any) {
|
||||
alert('LDK init error: ' + error.message);
|
||||
presentAlert({ message: 'LDK init error: ' + error.message });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ export class LightningLdkWallet extends LightningCustodianWallet {
|
|||
try {
|
||||
await func.call(that);
|
||||
} catch (error: any) {
|
||||
alert('_execInBackground error:' + error.message);
|
||||
presentAlert({ message: '_execInBackground error:' + error.message });
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Alert } from 'react-native';
|
||||
import loc from '../loc';
|
||||
const alert = (text: string) => {
|
||||
Alert.alert(loc.alert.default, text);
|
||||
const presentAlert = ({ title, message }: { title?: string; message: string }) => {
|
||||
Alert.alert(title ?? loc.alert.default, message);
|
||||
};
|
||||
export default alert;
|
||||
export default presentAlert;
|
||||
|
|
|
@ -13,6 +13,7 @@ import { BitcoinUnit } from '../../models/bitcoinUnits';
|
|||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { AbstractWallet } from '../../class';
|
||||
import Biometric from '../../class/biometrics';
|
||||
import presentAlert from '../Alert';
|
||||
const confirm = require('../../helpers/confirm');
|
||||
|
||||
interface AddressItemProps {
|
||||
|
@ -90,19 +91,19 @@ const AddressItem = ({ item, balanceUnit, walletID, allowSignVerifyMessage }: Ad
|
|||
const handleCopyPrivkeyPress = () => {
|
||||
const wallet = wallets.find((w: AbstractWallet) => w.getID() === walletID);
|
||||
if (!wallet) {
|
||||
alert('Internal error: cant find wallet');
|
||||
presentAlert({ message: 'Internal error: cant find wallet' });
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const wif = wallet._getWIFbyAddress(item.address);
|
||||
if (!wif) {
|
||||
alert('Internal error: cant get WIF from the wallet');
|
||||
presentAlert({ message: 'Internal error: cant get WIF from the wallet' });
|
||||
return;
|
||||
}
|
||||
Clipboard.setString(wif);
|
||||
} catch (error: any) {
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import BottomModal from '../../components/BottomModal';
|
|||
import Button from '../../components/Button';
|
||||
import { Psbt } from 'bitcoinjs-lib';
|
||||
import { AbstractWallet, LightningLdkWallet } from '../../class';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import StyledButton, { StyledButtonType } from '../../components/StyledButton';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
|
@ -174,7 +174,7 @@ const LdkInfo = () => {
|
|||
|
||||
console.warn('want to close to wallet ', toWallet.getLabel());
|
||||
const address = await toWallet.getAddressAsync();
|
||||
if (!address) return alert('Error: could not get address for channel withdrawal');
|
||||
if (!address) return presentAlert({ message: 'Error: could not get address for channel withdrawal' });
|
||||
await wallet.setRefundAddress(address);
|
||||
|
||||
let forceClose = false;
|
||||
|
@ -184,7 +184,7 @@ const LdkInfo = () => {
|
|||
}
|
||||
const rez = await wallet.closeChannel(channel.channel_id, forceClose);
|
||||
if (rez) {
|
||||
alert(loc._.success);
|
||||
presentAlert({ message: loc._.success });
|
||||
return refetchData();
|
||||
}
|
||||
};
|
||||
|
@ -208,7 +208,7 @@ const LdkInfo = () => {
|
|||
try {
|
||||
const rez = await wallet.claimCoins(address);
|
||||
if (rez) {
|
||||
alert(loc._.success);
|
||||
presentAlert({ message: loc._.success });
|
||||
await refetchData();
|
||||
}
|
||||
} finally {
|
||||
|
@ -318,7 +318,7 @@ const LdkInfo = () => {
|
|||
const navigateToOpenChannel = async ({ isPrivateChannel }: { isPrivateChannel: boolean }) => {
|
||||
const availableWallets = [...wallets.filter((item: AbstractWallet) => item.isSegwit() && item.allowSend())];
|
||||
if (availableWallets.length === 0) {
|
||||
return alert(loc.lnd.refill_create);
|
||||
return presentAlert({ message: loc.lnd.refill_create });
|
||||
}
|
||||
// @ts-ignore: Address types later
|
||||
navigate('LDKOpenChannelRoot', {
|
||||
|
|
|
@ -13,7 +13,7 @@ import { AbstractWallet, HDSegwitBech32Wallet, LightningLdkWallet } from '../../
|
|||
import { ArrowPicker } from '../../components/ArrowPicker';
|
||||
import { Psbt } from 'bitcoinjs-lib';
|
||||
import Biometric from '../../class/biometrics';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
|
@ -69,7 +69,7 @@ const LdkOpenChannel = (props: any) => {
|
|||
if (psbtOpenChannelStartedTs.current ? +new Date() - psbtOpenChannelStartedTs.current >= 5 * 60 * 1000 : false) {
|
||||
// its 10 min actually, but lets check 5 min just for any case
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert('Channel opening expired. Please try again');
|
||||
return presentAlert({ message: 'Channel opening expired. Please try again' });
|
||||
}
|
||||
|
||||
setVerified(true);
|
||||
|
@ -96,7 +96,7 @@ const LdkOpenChannel = (props: any) => {
|
|||
// its 10 min actually, but lets check 5 min just for any case
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setIsLoading(false);
|
||||
return alert('Channel opening expired. Please try again');
|
||||
return presentAlert({ message: 'Channel opening expired. Please try again' });
|
||||
}
|
||||
|
||||
const tx = psbt.extractTransaction();
|
||||
|
@ -105,7 +105,7 @@ const LdkOpenChannel = (props: any) => {
|
|||
if (!res) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setIsLoading(false);
|
||||
return alert('Something wend wrong during opening channel tx broadcast');
|
||||
return presentAlert({ message: 'Something wend wrong during opening channel tx broadcast' });
|
||||
}
|
||||
fetchAndSaveWalletTransactions(ldkWallet.getID());
|
||||
await new Promise(resolve => setTimeout(resolve, 3000)); // sleep to make sure network propagates
|
||||
|
@ -122,14 +122,14 @@ const LdkOpenChannel = (props: any) => {
|
|||
const amountSatsNumber = new BigNumber(fundingAmount.amountSats).toNumber();
|
||||
if (!amountSatsNumber) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert('Amount is not valid');
|
||||
return presentAlert({ message: 'Amount is not valid' });
|
||||
}
|
||||
|
||||
const pubkey = remoteHostWithPubkey.split('@')[0];
|
||||
const host = remoteHostWithPubkey.split('@')[1];
|
||||
if (!pubkey || !host) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert('Remote node address is not valid');
|
||||
return presentAlert({ message: 'Remote node address is not valid' });
|
||||
}
|
||||
|
||||
const fundingAddressTemp = await ldkWallet.openChannel(pubkey, host, fundingAmount.amountSats, isPrivateChannel);
|
||||
|
@ -143,7 +143,7 @@ const LdkOpenChannel = (props: any) => {
|
|||
reason += event.reason + ' ' + event.text;
|
||||
}
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert('Initiating channel open failed: ' + reason);
|
||||
return presentAlert({ message: 'Initiating channel open failed: ' + reason });
|
||||
}
|
||||
|
||||
psbtOpenChannelStartedTs.current = +new Date();
|
||||
|
@ -164,7 +164,7 @@ const LdkOpenChannel = (props: any) => {
|
|||
});
|
||||
} catch (error: any) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import loc, { formatBalance, formatBalanceWithoutSuffix, formatBalancePlain } fr
|
|||
import Lnurl from '../../class/lnurl';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
|
@ -132,7 +132,7 @@ const LNDCreateInvoice = () => {
|
|||
}
|
||||
} else {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert(loc.wallets.add_ln_wallet_first);
|
||||
presentAlert({ message: loc.wallets.add_ln_wallet_first });
|
||||
goBack();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
@ -180,7 +180,7 @@ const LNDCreateInvoice = () => {
|
|||
: loc.formatString(loc.receive.maxSatsFull, { max, currency: formatBalance(max, unit) });
|
||||
}
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert(text);
|
||||
presentAlert({ message: text });
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ const LNDCreateInvoice = () => {
|
|||
} catch (Err) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setIsLoading(false);
|
||||
alert(Err.message);
|
||||
presentAlert({ message: Err.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -233,7 +233,7 @@ const LNDCreateInvoice = () => {
|
|||
setIsLoading(true);
|
||||
if (!wallet.current) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert(loc.wallets.no_ln_wallet_error);
|
||||
presentAlert({ message: loc.wallets.no_ln_wallet_error });
|
||||
return goBack();
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ const LNDCreateInvoice = () => {
|
|||
Keyboard.dismiss();
|
||||
setIsLoading(false);
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert(Err.message);
|
||||
presentAlert({ message: Err.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
|
@ -36,7 +36,7 @@ const LNDViewAdditionalInvoiceInformation = () => {
|
|||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
alert(loc.errors.network);
|
||||
presentAlert({ message: loc.errors.network });
|
||||
goBack();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
|
|||
import loc, { formatBalanceWithoutSuffix, formatBalance } from '../../loc';
|
||||
import Biometric from '../../class/biometrics';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
|
@ -62,7 +62,7 @@ const LnurlPay = () => {
|
|||
ln.callLnurlPayService()
|
||||
.then(setPayload)
|
||||
.catch(error => {
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
pop();
|
||||
});
|
||||
setLN(ln);
|
||||
|
@ -81,7 +81,7 @@ const LnurlPay = () => {
|
|||
let originalSatAmount;
|
||||
let newAmount = (originalSatAmount = LN.getMin());
|
||||
if (!newAmount) {
|
||||
alert('Internal error: incorrect LNURL amount');
|
||||
presentAlert({ message: 'Internal error: incorrect LNURL amount' });
|
||||
return;
|
||||
}
|
||||
switch (unit) {
|
||||
|
@ -163,7 +163,7 @@ const LnurlPay = () => {
|
|||
setIsLoading(false);
|
||||
setPayButtonDisabled(false);
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert(Err.message);
|
||||
return presentAlert({ message: Err.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
|
|||
import Biometric from '../../class/biometrics';
|
||||
import loc, { formatBalanceWithoutSuffix } from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
|
@ -84,7 +84,7 @@ const ScanLndInvoice = () => {
|
|||
if (!wallet) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
goBack();
|
||||
setTimeout(() => alert(loc.wallets.no_ln_wallet_error), 500);
|
||||
setTimeout(() => presentAlert({ message: loc.wallets.no_ln_wallet_error }), 500);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [wallet]),
|
||||
|
@ -128,7 +128,7 @@ const ScanLndInvoice = () => {
|
|||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
Keyboard.dismiss();
|
||||
setParams({ uri: undefined });
|
||||
setTimeout(() => alert(Err.message), 10);
|
||||
setTimeout(() => presentAlert({ message: Err.message }), 10);
|
||||
setIsLoading(false);
|
||||
setAmount();
|
||||
setDestination();
|
||||
|
@ -194,14 +194,14 @@ const ScanLndInvoice = () => {
|
|||
if (+new Date() > newExpiresIn) {
|
||||
setIsLoading(false);
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert(loc.lnd.errorInvoiceExpired);
|
||||
return presentAlert({ message: loc.lnd.errorInvoiceExpired });
|
||||
}
|
||||
|
||||
const currentUserInvoices = wallet.user_invoices_raw; // not fetching invoices, as we assume they were loaded previously
|
||||
if (currentUserInvoices.some(i => i.payment_hash === decoded.payment_hash)) {
|
||||
setIsLoading(false);
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert(loc.lnd.sameWalletAsInvoiceError);
|
||||
return presentAlert({ message: loc.lnd.sameWalletAsInvoiceError });
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -210,7 +210,7 @@ const ScanLndInvoice = () => {
|
|||
console.log(Err.message);
|
||||
setIsLoading(false);
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert(Err.message);
|
||||
return presentAlert({ message: Err.message });
|
||||
}
|
||||
|
||||
navigate('Success', {
|
||||
|
|
|
@ -6,7 +6,7 @@ import navigationStyle from '../components/navigationStyle';
|
|||
import { BlueLoading, BlueCard, BlueText, BlueSpacing20 } from '../BlueComponents';
|
||||
import loc from '../loc';
|
||||
import { BlueStorageContext } from '../blue_modules/storage-context';
|
||||
import alert from '../components/Alert';
|
||||
import presentAlert from '../components/Alert';
|
||||
import Button from '../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback';
|
||||
import SafeArea from '../components/SafeArea';
|
||||
|
@ -25,7 +25,7 @@ const PlausibleDeniability = () => {
|
|||
if (isProvidedPasswordInUse) {
|
||||
setIsLoading(false);
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert(loc.plausibledeniability.password_should_not_match);
|
||||
return presentAlert({ message: loc.plausibledeniability.password_should_not_match });
|
||||
}
|
||||
if (!p1) {
|
||||
setIsLoading(false);
|
||||
|
@ -35,13 +35,13 @@ const PlausibleDeniability = () => {
|
|||
if (p1 !== p2) {
|
||||
setIsLoading(false);
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return alert(loc.plausibledeniability.passwords_do_not_match);
|
||||
return presentAlert({ message: loc.plausibledeniability.passwords_do_not_match });
|
||||
}
|
||||
|
||||
await createFakeStorage(p1);
|
||||
await resetWallets();
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||
alert(loc.plausibledeniability.success);
|
||||
presentAlert({ message: loc.plausibledeniability.success });
|
||||
popToTop();
|
||||
} catch {
|
||||
setIsLoading(false);
|
||||
|
|
|
@ -8,7 +8,7 @@ import { navigationStyleTx } from '../../components/navigationStyle';
|
|||
import loc from '../../loc';
|
||||
import Azteco from '../../class/azteco';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import Button from '../../components/Button';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
@ -64,7 +64,7 @@ export default class AztecoRedeem extends Component {
|
|||
const wallets = context.wallets;
|
||||
|
||||
if (wallets.length === 0) {
|
||||
alert(loc.azteco.errorBeforeRefeem);
|
||||
presentAlert({ message: loc.azteco.errorBeforeRefeem });
|
||||
return props.navigation.goBack(null);
|
||||
} else {
|
||||
if (wallets.length > 0) {
|
||||
|
@ -97,12 +97,12 @@ export default class AztecoRedeem extends Component {
|
|||
const address = await this.state.toWallet.getAddressAsync();
|
||||
const result = await Azteco.redeem([this.state.c1, this.state.c2, this.state.c3, this.state.c4], address);
|
||||
if (!result) {
|
||||
alert(loc.azteco.errorSomething);
|
||||
presentAlert({ message: loc.azteco.errorSomething });
|
||||
this.setState({ isLoading: false });
|
||||
} else {
|
||||
this.props.navigation.pop();
|
||||
// remote because we want to refetch from server tx list and balance
|
||||
alert(loc.azteco.success);
|
||||
presentAlert({ message: loc.azteco.success });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import {
|
|||
import ecc from '../blue_modules/noble_ecc';
|
||||
import Button from '../components/Button';
|
||||
import SafeArea from '../components/SafeArea';
|
||||
import alert from '../components/Alert';
|
||||
import presentAlert from '../components/Alert';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const BlueCrypto = require('react-native-blue-crypto');
|
||||
const encryption = require('../blue_modules/encryption');
|
||||
|
@ -49,9 +49,9 @@ export default class Selftest extends Component {
|
|||
try {
|
||||
fs.showFilePickerAndReadFile().then(file => {
|
||||
if (file && file.data && file.data.length > 0) {
|
||||
alert(file.data);
|
||||
presentAlert({ message: file.data });
|
||||
} else {
|
||||
alert('Error reading file');
|
||||
presentAlert({ message: 'Error reading file' });
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import { decodeUR, extractSingleWorkload, BlueURDecoder } from '../../blue_modul
|
|||
import { useNavigation, useRoute, useIsFocused } from '@react-navigation/native';
|
||||
import loc from '../../loc';
|
||||
import { BlueLoading, BlueText, BlueSpacing40 } from '../../BlueComponents';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { openPrivacyDesktopSettings } from '../../class/camera';
|
||||
import { isCameraAuthorizationStatusGranted } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
|
@ -288,7 +288,7 @@ const ScanQRCode = () => {
|
|||
if (!error) {
|
||||
onBarCodeRead({ data: result });
|
||||
} else {
|
||||
alert(loc.send.qr_error_no_qrcode);
|
||||
presentAlert({ message: loc.send.qr_error_no_qrcode });
|
||||
setIsLoading(false);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ActivityIndicator, Alert, KeyboardAvoidingView, Linking, StyleSheet, Platform, TextInput, View, Keyboard } from 'react-native';
|
||||
import { ActivityIndicator, KeyboardAvoidingView, Linking, StyleSheet, Platform, TextInput, View, Keyboard } from 'react-native';
|
||||
import { useRoute, useNavigation } from '@react-navigation/native';
|
||||
import * as bitcoin from 'bitcoinjs-lib';
|
||||
|
||||
|
@ -22,6 +22,7 @@ import { useTheme } from '../../components/themes';
|
|||
import Button from '../../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
||||
const scanqr = require('../../helpers/scan-qr');
|
||||
|
||||
|
@ -70,7 +71,7 @@ const Broadcast = () => {
|
|||
setBroadcastResult(BROADCAST_RESULT.error);
|
||||
}
|
||||
} catch (error) {
|
||||
Alert.alert(loc.errors.error, error.message);
|
||||
presentAlert({ title: loc.errors.error, message: error.message });
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setBroadcastResult(BROADCAST_RESULT.error);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import loc, { formatBalance, formatBalanceWithoutSuffix } from '../../loc';
|
|||
import Notifications from '../../blue_modules/notifications';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
|
@ -155,7 +155,7 @@ const Confirm = () => {
|
|||
} catch (error) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setIsLoading(false);
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import loc from '../../loc';
|
|||
import { DynamicQRCode } from '../../components/DynamicQRCode';
|
||||
import { isDesktop } from '../../blue_modules/environment';
|
||||
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { PERMISSIONS, RESULTS, request } from 'react-native-permissions';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import { satoshiToBTC } from '../../blue_modules/currency';
|
||||
|
@ -76,10 +76,10 @@ const SendCreate = () => {
|
|||
const filePath = RNFS.DownloadDirectoryPath + `/${fileName}`;
|
||||
try {
|
||||
await RNFS.writeFile(filePath, tx);
|
||||
alert(loc.formatString(loc.send.txSaved, { filePath }));
|
||||
presentAlert({ message: loc.formatString(loc.send.txSaved, { filePath }) });
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
alert(e.message);
|
||||
presentAlert({ message: e.message });
|
||||
}
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
|
|
|
@ -45,6 +45,7 @@ import Button from '../../components/Button';
|
|||
import ListItem from '../../components/ListItem';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { btcToSatoshi, fiatToBTC } from '../../blue_modules/currency';
|
||||
import presentAlert from '../../components/Alert';
|
||||
const prompt = require('../../helpers/prompt');
|
||||
const fs = require('../../blue_modules/fs');
|
||||
const btcAddressRx = /^[a-zA-Z0-9]{26,35}$/;
|
||||
|
@ -161,7 +162,7 @@ const SendDetails = () => {
|
|||
setPayjoinUrl(pjUrl);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
Alert.alert(loc.errors.error, loc.send.details_error_decode);
|
||||
presentAlert({ title: loc.errors.error, message: loc.send.details_error_decode });
|
||||
}
|
||||
} else if (routeParams.address) {
|
||||
const { amount, amountSats, unit = BitcoinUnit.BTC } = routeParams;
|
||||
|
@ -191,7 +192,7 @@ const SendDetails = () => {
|
|||
// check if we have a suitable wallet
|
||||
const suitable = wallets.filter(w => w.chain === Chain.ONCHAIN && w.allowSend());
|
||||
if (suitable.length === 0) {
|
||||
Alert.alert(loc.errors.error, loc.send.details_wallet_before_tx);
|
||||
presentAlert({ title: loc.errors.error, message: loc.send.details_wallet_before_tx });
|
||||
navigation.goBack();
|
||||
return;
|
||||
}
|
||||
|
@ -395,7 +396,7 @@ const SendDetails = () => {
|
|||
if (!data.replace) {
|
||||
// user probably scanned PSBT and got an object instead of string..?
|
||||
setIsLoading(false);
|
||||
return Alert.alert(loc.errors.error, loc.send.details_address_field_is_not_valid);
|
||||
return presentAlert({ title: loc.errors.error, message: loc.send.details_address_field_is_not_valid });
|
||||
}
|
||||
|
||||
const dataWithoutSchema = data.replace('bitcoin:', '').replace('BITCOIN:', '');
|
||||
|
@ -485,7 +486,7 @@ const SendDetails = () => {
|
|||
if (error) {
|
||||
scrollView.current.scrollToIndex({ index });
|
||||
setIsLoading(false);
|
||||
Alert.alert(loc.errors.error, error);
|
||||
presentAlert({ title: loc.errors.error, message: error.message });
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
return;
|
||||
}
|
||||
|
@ -495,7 +496,7 @@ const SendDetails = () => {
|
|||
await createPsbtTransaction();
|
||||
} catch (Err) {
|
||||
setIsLoading(false);
|
||||
Alert.alert(loc.errors.error, Err.message);
|
||||
presentAlert({ title: loc.errors.error, message: Err.message });
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
}
|
||||
};
|
||||
|
@ -600,7 +601,7 @@ const SendDetails = () => {
|
|||
*/
|
||||
const importQrTransaction = () => {
|
||||
if (wallet.type !== WatchOnlyWallet.type) {
|
||||
return Alert.alert(loc.errors.error, 'Error: importing transaction in non-watchonly wallet (this should never happen)');
|
||||
return presentAlert({ title: loc.errors.error, message: 'Importing transaction in non-watchonly wallet (this should never happen)' });
|
||||
}
|
||||
|
||||
setOptionsVisible(false);
|
||||
|
@ -619,7 +620,7 @@ const SendDetails = () => {
|
|||
navigation.getParent().pop();
|
||||
if (!ret.data) ret = { data: ret };
|
||||
if (ret.data.toUpperCase().startsWith('UR')) {
|
||||
Alert.alert(loc.errors.error, 'BC-UR not decoded. This should never happen');
|
||||
presentAlert({ title: loc.errors.error, message: 'BC-UR not decoded. This should never happen' });
|
||||
} else if (ret.data.indexOf('+') === -1 && ret.data.indexOf('=') === -1 && ret.data.indexOf('=') === -1) {
|
||||
// this looks like NOT base64, so maybe its transaction's hex
|
||||
// we dont support it in this flow
|
||||
|
@ -649,7 +650,7 @@ const SendDetails = () => {
|
|||
*/
|
||||
const importTransaction = async () => {
|
||||
if (wallet.type !== WatchOnlyWallet.type) {
|
||||
return Alert.alert(loc.errors.error, 'Importing transaction in non-watchonly wallet (this should never happen)');
|
||||
return presentAlert({ title: loc.errors.error, message: 'Importing transaction in non-watchonly wallet (this should never happen)' });
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -692,10 +693,10 @@ const SendDetails = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
Alert.alert(loc.errors.error, loc.send.details_unrecognized_file_format);
|
||||
presentAlert({ title: loc.errors.error, message: loc.send.details_unrecognized_file_format });
|
||||
} catch (err) {
|
||||
if (!DocumentPicker.isCancel(err)) {
|
||||
Alert.alert(loc.errors.error, loc.send.details_no_signed_tx);
|
||||
presentAlert({ title: loc.errors.error, message: loc.send.details_no_signed_tx });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -742,7 +743,7 @@ const SendDetails = () => {
|
|||
walletID: wallet.getID(),
|
||||
});
|
||||
} catch (error) {
|
||||
Alert.alert(loc.send.problem_with_psbt, error.message);
|
||||
presentAlert({ title: loc.send.problem_with_psbt, message: error.message });
|
||||
}
|
||||
setIsLoading(false);
|
||||
setOptionsVisible(false);
|
||||
|
@ -756,7 +757,7 @@ const SendDetails = () => {
|
|||
navigation.getParent().pop();
|
||||
if (!ret.data) ret = { data: ret };
|
||||
if (ret.data.toUpperCase().startsWith('UR')) {
|
||||
Alert.alert(loc.errors.error, 'BC-UR not decoded. This should never happen');
|
||||
presentAlert({ title: loc.errors.error, message: 'BC-UR not decoded. This should never happen' });
|
||||
} else if (ret.data.indexOf('+') === -1 && ret.data.indexOf('=') === -1 && ret.data.indexOf('=') === -1) {
|
||||
// this looks like NOT base64, so maybe its transaction's hex
|
||||
// we dont support it in this flow
|
||||
|
@ -823,7 +824,7 @@ const SendDetails = () => {
|
|||
psbt = bitcoin.Psbt.fromBase64(scannedData);
|
||||
tx = wallet.cosignPsbt(psbt).tx;
|
||||
} catch (e) {
|
||||
Alert.alert(loc.errors.error, e.message);
|
||||
presentAlert({ title: loc.errors.error, message: e.message });
|
||||
return;
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
|
|
|
@ -8,7 +8,7 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import loc from '../../loc';
|
||||
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
|
@ -158,7 +158,7 @@ const PsbtMultisig = () => {
|
|||
const newPsbt = psbt.combine(receivedPSBT);
|
||||
setPsbt(newPsbt);
|
||||
} catch (error) {
|
||||
alert(error);
|
||||
presentAlert({ message: error });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -186,7 +186,7 @@ const PsbtMultisig = () => {
|
|||
satoshiPerByte,
|
||||
});
|
||||
} catch (error) {
|
||||
alert(error);
|
||||
presentAlert({ message: error });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import { DynamicQRCode } from '../../components/DynamicQRCode';
|
|||
import { SquareButton } from '../../components/SquareButton';
|
||||
|
||||
import loc from '../../loc';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
|
@ -52,11 +52,11 @@ const PsbtMultisigQRCode = () => {
|
|||
const onBarScanned = ret => {
|
||||
if (!ret.data) ret = { data: ret };
|
||||
if (ret.data.toUpperCase().startsWith('UR')) {
|
||||
alert('BC-UR not decoded. This should never happen');
|
||||
presentAlert({ message: 'BC-UR not decoded. This should never happen' });
|
||||
} else if (ret.data.indexOf('+') === -1 && ret.data.indexOf('=') === -1 && ret.data.indexOf('=') === -1) {
|
||||
// this looks like NOT base64, so maybe its transaction's hex
|
||||
// we dont support it in this flow
|
||||
alert(loc.wallets.import_error);
|
||||
presentAlert({ message: loc.wallets.import_error });
|
||||
} else {
|
||||
// psbt base64?
|
||||
navigate({ name: 'PsbtMultisig', params: { receivedPSBTBase64: ret.data }, merge: true });
|
||||
|
|
|
@ -12,7 +12,7 @@ import loc from '../../loc';
|
|||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import { DynamicQRCode } from '../../components/DynamicQRCode';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
|
@ -65,7 +65,7 @@ const PsbtWithHardwareWallet = () => {
|
|||
const onBarScanned = ret => {
|
||||
if (ret && !ret.data) ret = { data: ret };
|
||||
if (ret.data.toUpperCase().startsWith('UR')) {
|
||||
alert('BC-UR not decoded. This should never happen');
|
||||
presentAlert({ message: 'BC-UR not decoded. This should never happen' });
|
||||
}
|
||||
if (ret.data.indexOf('+') === -1 && ret.data.indexOf('=') === -1 && ret.data.indexOf('=') === -1) {
|
||||
// this looks like NOT base64, so maybe its transaction's hex
|
||||
|
@ -83,7 +83,7 @@ const PsbtWithHardwareWallet = () => {
|
|||
// (passed by reference)
|
||||
}
|
||||
} catch (Err) {
|
||||
alert(Err.message);
|
||||
presentAlert({ message: Err.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ const PsbtWithHardwareWallet = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (!psbt && !route.params.txhex) {
|
||||
alert(loc.send.no_tx_signing_in_progress);
|
||||
presentAlert({ message: loc.send.no_tx_signing_in_progress });
|
||||
}
|
||||
|
||||
if (deepLinkPSBT) {
|
||||
|
@ -106,7 +106,7 @@ const PsbtWithHardwareWallet = () => {
|
|||
const Tx = fromWallet.combinePsbt(routeParamsPSBT.current, newPsbt);
|
||||
setTxHex(Tx.toHex());
|
||||
} catch (Err) {
|
||||
alert(Err);
|
||||
presentAlert({ message: Err });
|
||||
}
|
||||
} else if (routeParamsTXHex) {
|
||||
setTxHex(routeParamsTXHex);
|
||||
|
@ -142,12 +142,12 @@ const PsbtWithHardwareWallet = () => {
|
|||
} else {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setIsLoading(false);
|
||||
alert(loc.errors.broadcast);
|
||||
presentAlert({ message: loc.errors.broadcast });
|
||||
}
|
||||
} catch (error) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setIsLoading(false);
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -205,7 +205,7 @@ const PsbtWithHardwareWallet = () => {
|
|||
}
|
||||
} catch (err) {
|
||||
if (!DocumentPicker.isCancel(err)) {
|
||||
alert(loc.send.details_no_signed_tx);
|
||||
presentAlert({ message: loc.send.details_no_signed_tx });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ import { FiatUnit, FiatUnitSource, FiatUnitType, getFiatRate } from '../../model
|
|||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import dayjs from 'dayjs';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import ListItem from '../../components/ListItem';
|
||||
import {
|
||||
|
@ -86,7 +86,9 @@ const Currency: React.FC = () => {
|
|||
setPreferredFiatCurrency();
|
||||
} catch (error: any) {
|
||||
console.log(error);
|
||||
alert(error.message ? `${loc.settings.currency_fetch_error}: ${error.message}}` : loc.settings.currency_fetch_error);
|
||||
presentAlert({
|
||||
message: error.message ? `${loc.settings.currency_fetch_error}: ${error.message}}` : loc.settings.currency_fetch_error,
|
||||
});
|
||||
} finally {
|
||||
setIsSavingNewPreferredCurrency(false);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import loc, { formatStringAddTwoWhiteSpaces } from '../../loc';
|
||||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { HDSegwitBech32Wallet } from '../../class';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
|
@ -84,7 +84,7 @@ const About = () => {
|
|||
|
||||
const handleOnSelfTestPress = () => {
|
||||
if (isElectrumDisabled) {
|
||||
alert(loc.settings.about_selftest_electrum_disabled);
|
||||
presentAlert({ message: loc.settings.about_selftest_electrum_disabled });
|
||||
} else {
|
||||
navigate('Selftest');
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import {
|
|||
import { BlueCurrentTheme } from '../../components/themes';
|
||||
import WidgetCommunication from '../../blue_modules/WidgetCommunication';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import Button from '../../components/Button';
|
||||
import ListItem from '../../components/ListItem';
|
||||
|
@ -112,7 +112,7 @@ export default class ElectrumSettings extends Component {
|
|||
this.setState({ isLoading: true }, async () => {
|
||||
const features = await BlueElectrum.serverFeatures();
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationWarning);
|
||||
alert(JSON.stringify(features, null, 2));
|
||||
presentAlert({ message: JSON.stringify(features, null, 2) });
|
||||
this.setState({ isLoading: false });
|
||||
});
|
||||
};
|
||||
|
@ -177,10 +177,10 @@ export default class ElectrumSettings extends Component {
|
|||
console.log(e);
|
||||
}
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||
alert(loc.settings.electrum_saved);
|
||||
presentAlert({ message: loc.settings.electrum_saved });
|
||||
} else if (!(await BlueElectrum.testConnection(host, port, sslPort))) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert(loc.settings.electrum_error_connect);
|
||||
presentAlert({ message: loc.settings.electrum_error_connect });
|
||||
} else {
|
||||
await AsyncStorage.setItem(BlueElectrum.ELECTRUM_HOST, host);
|
||||
await AsyncStorage.setItem(BlueElectrum.ELECTRUM_TCP_PORT, port);
|
||||
|
@ -206,11 +206,11 @@ export default class ElectrumSettings extends Component {
|
|||
console.log(e);
|
||||
}
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||
alert(loc.settings.electrum_saved);
|
||||
presentAlert({ message: loc.settings.electrum_saved });
|
||||
}
|
||||
} catch (error) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
alert(error);
|
||||
presentAlert({ message: error });
|
||||
}
|
||||
this.setState({ isLoading: false });
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ import { BlueLoading, BlueSpacing20, BlueCard, BlueText } from '../../BlueCompon
|
|||
import Biometric from '../../class/biometrics';
|
||||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import ListItem from '../../components/ListItem';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import { useTheme } from '../../components/themes';
|
||||
|
@ -53,7 +53,7 @@ const EncryptStorage = () => {
|
|||
popToTop();
|
||||
} catch (e) {
|
||||
if (password) {
|
||||
alert(loc._.bad_password);
|
||||
presentAlert({ message: loc._.bad_password });
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ const EncryptStorage = () => {
|
|||
saveToDisk();
|
||||
} else {
|
||||
setIsLoading(false);
|
||||
alert(loc.settings.passwords_do_not_match);
|
||||
presentAlert({ message: loc.settings.passwords_do_not_match });
|
||||
}
|
||||
} else {
|
||||
Alert.alert(
|
||||
|
|
|
@ -7,7 +7,7 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import loc, { saveLanguage } from '../../loc';
|
||||
import { AvailableLanguages, TLanguage } from '../../loc/languages';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import ListItem from '../../components/ListItem';
|
||||
|
||||
|
@ -43,7 +43,7 @@ const Language: React.FC = () => {
|
|||
setSelectedLanguage(item.value);
|
||||
setLanguage();
|
||||
if (currentLanguage?.isRTL !== item.isRTL) {
|
||||
alert(loc.settings.language_isRTL);
|
||||
presentAlert({ message: loc.settings.language_isRTL });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ import { LightningCustodianWallet } from '../../class/wallets/lightning-custodia
|
|||
import loc from '../../loc';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import DeeplinkSchemaMatch from '../../class/deeplink-schema-match';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import { Button } from '../../components/Button';
|
||||
|
||||
|
@ -107,9 +107,9 @@ const LightningSettings: React.FC & { navigationOptions: NavigationOptionsGetter
|
|||
} else {
|
||||
await AsyncStorage.removeItem(AppStorage.LNDHUB);
|
||||
}
|
||||
alert(loc.settings.lightning_saved);
|
||||
presentAlert({ message: loc.settings.lightning_saved });
|
||||
} catch (error) {
|
||||
alert(loc.settings.lightning_error_lndhub_uri);
|
||||
presentAlert({ message: loc.settings.lightning_error_lndhub_uri });
|
||||
console.log(error);
|
||||
}
|
||||
setIsLoading(false);
|
||||
|
|
|
@ -8,7 +8,7 @@ import { BlueCard, BlueCopyToClipboardButton, BlueLoading, BlueSpacing20, BlueTe
|
|||
import loc from '../../loc';
|
||||
import { BlueCurrentTheme, useTheme } from '../../components/themes';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { Button } from '../../components/Button';
|
||||
import ListItem from '../../components/ListItem';
|
||||
|
||||
|
@ -79,13 +79,13 @@ const NotificationSettings = () => {
|
|||
// validating only if its not empty. empty means use default
|
||||
if (await Notifications.isGroundControlUriValid(URI)) {
|
||||
await Notifications.saveUri(URI);
|
||||
alert(loc.settings.saved);
|
||||
presentAlert({ message: loc.settings.saved });
|
||||
} else {
|
||||
alert(loc.settings.not_a_valid_uri);
|
||||
presentAlert({ message: loc.settings.not_a_valid_uri });
|
||||
}
|
||||
} else {
|
||||
await Notifications.saveUri('');
|
||||
alert(loc.settings.saved);
|
||||
presentAlert({ message: loc.settings.saved });
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
|
|
|
@ -21,7 +21,7 @@ import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
|||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import Notifications from '../../blue_modules/notifications';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import Button from '../../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
|
@ -95,12 +95,12 @@ export default class CPFP extends Component {
|
|||
} else {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
this.setState({ isLoading: false });
|
||||
alert(loc.errors.broadcast);
|
||||
presentAlert({ message: loc.errors.broadcast });
|
||||
}
|
||||
} catch (error) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
this.setState({ isLoading: false });
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -154,7 +154,7 @@ export default class CPFP extends Component {
|
|||
this.setState({ isLoading: false });
|
||||
} catch (_) {
|
||||
this.setState({ isLoading: false });
|
||||
alert(loc.errors.error + ': ' + _.message);
|
||||
presentAlert({ message: loc.errors.error + ': ' + _.message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
|||
import CPFP from './CPFP';
|
||||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
|
@ -57,7 +57,7 @@ export default class RBFBumpFee extends CPFP {
|
|||
this.setState({ isLoading: false });
|
||||
} catch (_) {
|
||||
this.setState({ isLoading: false });
|
||||
alert(loc.errors.error + ': ' + _.message);
|
||||
presentAlert({ message: loc.errors.error + ': ' + _.message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { HDSegwitBech32Transaction, HDSegwitBech32Wallet } from '../../class';
|
|||
import CPFP from './CPFP';
|
||||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
|
||||
export default class RBFCancel extends CPFP {
|
||||
|
@ -55,7 +55,7 @@ export default class RBFCancel extends CPFP {
|
|||
this.setState({ isLoading: false });
|
||||
} catch (_) {
|
||||
this.setState({ isLoading: false });
|
||||
alert(loc.errors.error + ': ' + _.message);
|
||||
presentAlert({ message: loc.errors.error + ': ' + _.message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import HandoffComponent from '../../components/handoff';
|
|||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import ToolTipMenu from '../../components/TooltipMenu';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
|
@ -113,7 +113,7 @@ const TransactionsDetails = () => {
|
|||
const handleOnSaveButtonTapped = () => {
|
||||
Keyboard.dismiss();
|
||||
txMetadata[tx.hash] = { memo };
|
||||
saveToDisk().then(_success => alert(loc.transactions.transaction_note_saved));
|
||||
saveToDisk().then(_success => presentAlert({ message: loc.transactions.transaction_note_saved }));
|
||||
};
|
||||
|
||||
const handleOnOpenTransactionOnBlockExporerTapped = () => {
|
||||
|
@ -124,17 +124,17 @@ const TransactionsDetails = () => {
|
|||
Linking.openURL(url).catch(e => {
|
||||
console.log('openURL failed in handleOnOpenTransactionOnBlockExporerTapped');
|
||||
console.log(e.message);
|
||||
alert(e.message);
|
||||
presentAlert({ message: e.message });
|
||||
});
|
||||
} else {
|
||||
console.log('canOpenURL supported is false in handleOnOpenTransactionOnBlockExporerTapped');
|
||||
alert(loc.transactions.open_url_error);
|
||||
presentAlert({ message: loc.transactions.open_url_error });
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
console.log('canOpenURL failed in handleOnOpenTransactionOnBlockExporerTapped');
|
||||
console.log(e.message);
|
||||
alert(e.message);
|
||||
presentAlert({ message: e.message });
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import { Chain } from '../../models/bitcoinUnits';
|
|||
import loc from '../../loc';
|
||||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { LdkButton } from '../../components/LdkButton';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import useAsyncPromise from '../../hooks/useAsyncPromise';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
|
@ -240,7 +240,7 @@ const WalletsAdd: React.FC = () => {
|
|||
await w.generateFromEntropy(entropy);
|
||||
} catch (e: any) {
|
||||
console.log(e.toString());
|
||||
alert(e.toString());
|
||||
presentAlert({ message: e.toString() });
|
||||
goBack();
|
||||
return;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ const WalletsAdd: React.FC = () => {
|
|||
const createLightningLdkWallet = async () => {
|
||||
const foundLdk = wallets.find((w: AbstractWallet) => w.type === LightningLdkWallet.type);
|
||||
if (foundLdk) {
|
||||
return alert('LDK wallet already exists');
|
||||
return presentAlert({ message: 'LDK wallet already exists' });
|
||||
}
|
||||
setIsLoading(true);
|
||||
const wallet = new LightningLdkWallet();
|
||||
|
@ -314,9 +314,9 @@ const WalletsAdd: React.FC = () => {
|
|||
setIsLoading(false);
|
||||
console.warn('lnd create failure', Err);
|
||||
if (Err.message) {
|
||||
return alert(Err.message);
|
||||
return presentAlert({ message: Err.message });
|
||||
} else {
|
||||
return alert(loc.wallets.add_lndhub_error);
|
||||
return presentAlert({ message: loc.wallets.add_lndhub_error });
|
||||
}
|
||||
// giving app, not adding anything
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import MultipleStepsListItem, {
|
|||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import { encodeUR } from '../../blue_modules/ur';
|
||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import confirm from '../../helpers/confirm';
|
||||
import { scanQrHelper } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
|
@ -130,7 +130,7 @@ const WalletsAddMultisigStep2 = () => {
|
|||
await _onCreate(); // this can fail with "Duplicate fingerprint" error or other
|
||||
} catch (e) {
|
||||
setIsLoading(false);
|
||||
alert(e.message);
|
||||
presentAlert({ message: e.message });
|
||||
console.log('create MS wallet error', e);
|
||||
}
|
||||
};
|
||||
|
@ -261,7 +261,7 @@ const WalletsAddMultisigStep2 = () => {
|
|||
setIsLoading(false);
|
||||
setImportText('');
|
||||
setAskPassphrase(false);
|
||||
alert(loc.multisig.not_a_multisignature_xpub);
|
||||
presentAlert({ message: loc.multisig.not_a_multisignature_xpub });
|
||||
return;
|
||||
}
|
||||
if (fp) {
|
||||
|
@ -326,7 +326,7 @@ const WalletsAddMultisigStep2 = () => {
|
|||
hd.setSecret(importText);
|
||||
if (!hd.validateMnemonic()) {
|
||||
setIsLoading(false);
|
||||
return alert(loc.multisig.invalid_mnemonics);
|
||||
return presentAlert({ message: loc.multisig.invalid_mnemonics });
|
||||
}
|
||||
|
||||
let passphrase;
|
||||
|
@ -375,19 +375,19 @@ const WalletsAddMultisigStep2 = () => {
|
|||
} catch (_) {}
|
||||
|
||||
if (ret.data.toUpperCase().startsWith('UR')) {
|
||||
alert('BC-UR not decoded. This should never happen');
|
||||
presentAlert({ message: 'BC-UR not decoded. This should never happen' });
|
||||
} else if (isValidMnemonicSeed(ret.data)) {
|
||||
setIsProvideMnemonicsModalVisible(true);
|
||||
setImportText(ret.data);
|
||||
} else {
|
||||
if (MultisigHDWallet.isXpubValid(ret.data) && !MultisigHDWallet.isXpubForMultisig(ret.data)) {
|
||||
return alert(loc.multisig.not_a_multisignature_xpub);
|
||||
return presentAlert({ message: loc.multisig.not_a_multisignature_xpub });
|
||||
}
|
||||
if (MultisigHDWallet.isXpubValid(ret.data)) {
|
||||
return tryUsingXpub(ret.data);
|
||||
}
|
||||
let cosigner = new MultisigCosigner(ret.data);
|
||||
if (!cosigner.isValid()) return alert(loc.multisig.invalid_cosigner);
|
||||
if (!cosigner.isValid()) return presentAlert({ message: loc.multisig.invalid_cosigner });
|
||||
setIsProvideMnemonicsModalVisible(false);
|
||||
if (cosigner.howManyCosignersWeHave() > 1) {
|
||||
// lets look for the correct cosigner. thats probably gona be the one with specific corresponding path,
|
||||
|
@ -420,7 +420,7 @@ const WalletsAddMultisigStep2 = () => {
|
|||
}
|
||||
|
||||
for (const existingCosigner of cosigners) {
|
||||
if (existingCosigner[0] === cosigner.getXpub()) return alert(loc.multisig.this_cosigner_is_already_imported);
|
||||
if (existingCosigner[0] === cosigner.getXpub()) return presentAlert({ message: loc.multisig.this_cosigner_is_already_imported });
|
||||
}
|
||||
|
||||
// now, validating that cosigner is in correct format:
|
||||
|
@ -447,7 +447,7 @@ const WalletsAddMultisigStep2 = () => {
|
|||
throw new Error('This should never happen');
|
||||
}
|
||||
|
||||
if (!correctFormat) return alert(loc.formatString(loc.multisig.invalid_cosigner_format, { format }));
|
||||
if (!correctFormat) return presentAlert({ message: loc.formatString(loc.multisig.invalid_cosigner_format, { format }) });
|
||||
|
||||
const cosignersCopy = [...cosigners];
|
||||
cosignersCopy.push([cosigner.getXpub(), cosigner.getFp(), cosigner.getPath()]);
|
||||
|
|
|
@ -39,7 +39,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
|
|||
import Notifications from '../../blue_modules/notifications';
|
||||
import { isDesktop } from '../../blue_modules/environment';
|
||||
import { AbstractHDElectrumWallet } from '../../class/wallets/abstract-hd-electrum-wallet';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
|
||||
import { writeFileAndExport } from '../../blue_modules/fs';
|
||||
import { PERMISSIONS, RESULTS, request } from 'react-native-permissions';
|
||||
|
@ -196,7 +196,7 @@ const WalletDetails = () => {
|
|||
}
|
||||
saveToDisk()
|
||||
.then(() => {
|
||||
alert(loc.wallets.details_wallet_updated);
|
||||
presentAlert({ message: loc.wallets.details_wallet_updated });
|
||||
goBack();
|
||||
})
|
||||
.catch(error => {
|
||||
|
@ -261,7 +261,7 @@ const WalletDetails = () => {
|
|||
} else {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
setIsLoading(false);
|
||||
alert(loc.wallets.details_del_wb_err);
|
||||
presentAlert({ message: loc.wallets.details_del_wb_err });
|
||||
}
|
||||
} catch (_) {}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
@ -359,7 +359,7 @@ const WalletDetails = () => {
|
|||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
})
|
||||
.finally(() => {
|
||||
RNFS.unlink(filePath);
|
||||
|
@ -371,10 +371,10 @@ const WalletDetails = () => {
|
|||
const filePath = RNFS.DownloadDirectoryPath + `/${fileName}`;
|
||||
try {
|
||||
await RNFS.writeFile(filePath, contents);
|
||||
alert(loc.formatString(loc.send.txSaved, { filePath: fileName }));
|
||||
presentAlert({ message: loc.formatString(loc.send.txSaved, { filePath: fileName }) });
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
alert(e.message);
|
||||
presentAlert({ message: e.message });
|
||||
}
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
|
@ -400,13 +400,13 @@ const WalletDetails = () => {
|
|||
if (wallet.type === HDSegwitBech32Wallet.type) {
|
||||
wallet._txs_by_external_index = {};
|
||||
wallet._txs_by_internal_index = {};
|
||||
alert(msg);
|
||||
presentAlert({ message: msg });
|
||||
}
|
||||
|
||||
if (wallet._hdWalletInstance) {
|
||||
wallet._hdWalletInstance._txs_by_external_index = {};
|
||||
wallet._hdWalletInstance._txs_by_internal_index = {};
|
||||
alert(msg);
|
||||
presentAlert({ message: msg });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useContext, useEffect, useState, useRef, useMemo } from 'react';
|
||||
import { ActivityIndicator, Alert, FlatList, LayoutAnimation, StyleSheet, View } from 'react-native';
|
||||
import { ActivityIndicator, FlatList, LayoutAnimation, StyleSheet, View } from 'react-native';
|
||||
import IdleTimerManager from 'react-native-idle-timer';
|
||||
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||
import { BlueButtonLink, BlueFormLabel, BlueSpacing10, BlueSpacing20 } from '../../BlueComponents';
|
||||
|
@ -14,6 +14,7 @@ import { useTheme } from '../../components/themes';
|
|||
import Button from '../../components/Button';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
||||
const ImportWalletDiscovery = () => {
|
||||
const navigation = useNavigation();
|
||||
|
@ -90,7 +91,7 @@ const ImportWalletDiscovery = () => {
|
|||
})
|
||||
.catch(e => {
|
||||
console.warn('import error', e);
|
||||
Alert.alert('import error', e.message);
|
||||
presentAlert({ title: 'Import error', message: e.message });
|
||||
})
|
||||
.finally(() => {
|
||||
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useContext, useState } from 'react';
|
||||
import { Alert, View, StyleSheet, TextInput, ActivityIndicator } from 'react-native';
|
||||
import { View, StyleSheet, TextInput, ActivityIndicator } from 'react-native';
|
||||
import { useNavigation } from '@react-navigation/native';
|
||||
import { HDSegwitBech32Wallet, WatchOnlyWallet } from '../../class';
|
||||
import loc from '../../loc';
|
||||
|
@ -9,6 +9,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
|
|||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
||||
const WalletsImportSpeed = () => {
|
||||
const navigation = useNavigation();
|
||||
|
@ -66,7 +67,7 @@ const WalletsImportSpeed = () => {
|
|||
navigation.getParent().pop();
|
||||
addAndSaveWallet(wallet);
|
||||
} catch (e) {
|
||||
Alert.alert(e.message);
|
||||
presentAlert({ message: e.message });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import navigationStyle from '../../components/navigationStyle';
|
|||
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
||||
import loc from '../../loc';
|
||||
import { LightningLdkWallet } from '../../class';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
const fs = require('../../blue_modules/fs');
|
||||
|
@ -75,9 +75,9 @@ const LdkViewLogs = () => {
|
|||
const selfTest = async () => {
|
||||
try {
|
||||
await wallet.selftest();
|
||||
alert('ok');
|
||||
presentAlert({ message: 'ok' });
|
||||
} catch (error) {
|
||||
alert(error.message);
|
||||
presentAlert({ message: error.message });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import React, { useEffect, useState, useContext } from 'react';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Alert,
|
||||
Keyboard,
|
||||
KeyboardAvoidingView,
|
||||
LayoutAnimation,
|
||||
|
@ -22,6 +21,7 @@ import loc from '../../loc';
|
|||
import { useTheme } from '../../components/themes';
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||
import SafeArea from '../../components/SafeArea';
|
||||
import presentAlert from '../../components/Alert';
|
||||
|
||||
const SignVerify = () => {
|
||||
const { colors } = useTheme();
|
||||
|
@ -75,7 +75,7 @@ const SignVerify = () => {
|
|||
setIsShareVisible(true);
|
||||
} catch (e) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
Alert.alert(loc.errors.error, e.message);
|
||||
presentAlert({ title: loc.errors.error, message: e.message });
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
|
@ -86,16 +86,16 @@ const SignVerify = () => {
|
|||
await sleep(10); // wait for loading indicator to appear
|
||||
try {
|
||||
const res = wallet.verifyMessage(message, address, signature);
|
||||
Alert.alert(
|
||||
res ? loc._.success : loc.errors.error,
|
||||
res ? loc.addresses.sign_signature_correct : loc.addresses.sign_signature_incorrect,
|
||||
);
|
||||
presentAlert({
|
||||
title: res ? loc._.success : loc.errors.error,
|
||||
message: res ? loc.addresses.sign_signature_correct : loc.addresses.sign_signature_incorrect,
|
||||
});
|
||||
if (res) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
|
||||
}
|
||||
} catch (e) {
|
||||
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
|
||||
Alert.alert(loc.errors.error, e.message);
|
||||
presentAlert({ title: loc.errors.error, message: e.message });
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ import BlueClipboard from '../../blue_modules/clipboard';
|
|||
import LNNodeBar from '../../components/LNNodeBar';
|
||||
import TransactionsNavigationHeader, { actionKeys } from '../../components/TransactionsNavigationHeader';
|
||||
import { TransactionListItem } from '../../components/TransactionListItem';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import PropTypes from 'prop-types';
|
||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
|
@ -232,7 +232,7 @@ const WalletTransactions = ({ navigation }) => {
|
|||
console.log(wallet.getLabel(), 'fetch tx took', (end - start) / 1000, 'sec');
|
||||
} catch (err) {
|
||||
noErr = false;
|
||||
alert(err.message);
|
||||
presentAlert({ message: err.message });
|
||||
setIsLoading(false);
|
||||
setTimeElapsed(prev => prev + 1);
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ const WalletTransactions = ({ navigation }) => {
|
|||
await wallet.fetchBtcAddress();
|
||||
toAddress = wallet.refill_addressess[0];
|
||||
} catch (Err) {
|
||||
return alert(Err.message);
|
||||
return presentAlert({ message: Err.message });
|
||||
}
|
||||
}
|
||||
navigate('SendDetailsRoot', {
|
||||
|
@ -476,7 +476,7 @@ const WalletTransactions = ({ navigation }) => {
|
|||
if (id === actionKeys.Refill) {
|
||||
const availableWallets = [...wallets.filter(item => item.chain === Chain.ONCHAIN && item.allowSend())];
|
||||
if (availableWallets.length === 0) {
|
||||
alert(loc.lnd.refill_create);
|
||||
presentAlert({ message: loc.lnd.refill_create });
|
||||
} else {
|
||||
navigate('SelectWallet', { onWalletSelect, chainType: Chain.ONCHAIN });
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import Biometric from '../../class/biometrics';
|
|||
import { SquareButton } from '../../components/SquareButton';
|
||||
import { encodeUR } from '../../blue_modules/ur';
|
||||
import QRCodeComponent from '../../components/QRCodeComponent';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
import { scanQrHelper } from '../../helpers/scan-qr';
|
||||
import { useTheme } from '../../components/themes';
|
||||
import Button from '../../components/Button';
|
||||
|
@ -421,12 +421,12 @@ const ViewEditMultisigCosigners = ({ route }: NativeStackScreenProps<StackParams
|
|||
|
||||
const hd = new HDSegwitBech32Wallet();
|
||||
hd.setSecret(mnemonic);
|
||||
if (!hd.validateMnemonic()) return alert(loc.multisig.invalid_mnemonics);
|
||||
if (!hd.validateMnemonic()) return presentAlert({ message: loc.multisig.invalid_mnemonics });
|
||||
try {
|
||||
wallet.replaceCosignerXpubWithSeed(currentlyEditingCosignerNum, hd.getSecret(), passphrase);
|
||||
} catch (e: any) {
|
||||
console.log(e);
|
||||
return alert(e.message);
|
||||
return presentAlert({ message: e.message });
|
||||
}
|
||||
|
||||
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
||||
|
@ -444,7 +444,7 @@ const ViewEditMultisigCosigners = ({ route }: NativeStackScreenProps<StackParams
|
|||
wallet?.replaceCosignerSeedWithXpub(index);
|
||||
} catch (e: any) {
|
||||
reject(e);
|
||||
return alert(e.message);
|
||||
return presentAlert({ message: e.message });
|
||||
}
|
||||
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
||||
setWallet(wallet);
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as bip39 from 'bip39';
|
|||
import { HDSegwitBech32Wallet } from './hd-segwit-bech32-wallet';
|
||||
import bolt11 from 'bolt11';
|
||||
import { SegwitBech32Wallet } from './segwit-bech32-wallet';
|
||||
import alert from '../../components/Alert';
|
||||
import presentAlert from '../../components/Alert';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
export class LightningLdkWallet extends LightningCustodianWallet {
|
||||
|
@ -462,7 +462,7 @@ export class LightningLdkWallet extends LightningCustodianWallet {
|
|||
try {
|
||||
await func.call(that);
|
||||
} catch (error: any) {
|
||||
alert('_execInBackground error:' + error.message);
|
||||
presentAlert({ message: '_execInBackground error:' + error.message});
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue