REF: Haptic feedback into a class with power state verification (#5954)

This commit is contained in:
Marcos Rodriguez Vélez 2023-12-29 07:52:12 -04:00 committed by GitHub
parent 89ce917090
commit a08117a75f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 129 additions and 110 deletions

4
App.js
View File

@ -14,7 +14,6 @@ import {
} from 'react-native';
import { NavigationContainer, CommonActions } from '@react-navigation/native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { navigationRef } from './NavigationService';
import * as NavigationService from './NavigationService';
import { Chain } from './models/bitcoinUnits';
@ -32,6 +31,7 @@ import WidgetCommunication from './blue_modules/WidgetCommunication';
import ActionSheet from './screen/ActionSheet';
import HandoffComponent from './components/handoff';
import Privacy from './blue_modules/Privacy';
import triggerHapticFeedback, { HapticFeedbackTypes } from './blue_modules/hapticFeedback';
const A = require('./blue_modules/analytics');
const currency = require('./blue_modules/currency');
@ -260,7 +260,7 @@ const App = () => {
};
const showClipboardAlert = ({ contentType }) => {
ReactNativeHapticFeedback.trigger('impactLight', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.ImpactLight);
BlueClipboard()
.getClipboardContent()
.then(clipboard => {

View File

@ -6,8 +6,8 @@ import LottieView from 'lottie-react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { StackActions, useNavigation, useRoute } from '@react-navigation/native';
import { BlueStorageContext } from './blue_modules/storage-context';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { isHandset } from './blue_modules/environment';
import triggerHapticFeedback, { HapticFeedbackTypes } from './blue_modules/hapticFeedback';
const lottieJson = require('./img/bluewalletsplash.json');
const styles = StyleSheet.create({
@ -86,7 +86,8 @@ const UnlockWith = () => {
const unlockWithKey = async () => {
setIsAuthenticating(true);
if (await startAndDecrypt()) {
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
successfullyAuthenticated();
} else {
setIsAuthenticating(false);

View File

@ -0,0 +1,25 @@
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import DeviceInfo, { PowerState } from 'react-native-device-info';
// Define a const enum for HapticFeedbackTypes
export const enum HapticFeedbackTypes {
ImpactLight = 'impactLight',
ImpactMedium = 'impactMedium',
ImpactHeavy = 'impactHeavy',
Selection = 'selection',
NotificationSuccess = 'notificationSuccess',
NotificationWarning = 'notificationWarning',
NotificationError = 'notificationError',
}
const triggerHapticFeedback = (type: HapticFeedbackTypes) => {
DeviceInfo.getPowerState().then((state: Partial<PowerState>) => {
if (!state.lowPowerMode) {
ReactNativeHapticFeedback.trigger(type, { ignoreAndroidSystemSettings: false, enableVibrateFallback: true });
} else {
console.log('Haptic feedback not triggered due to low power mode.');
}
});
};
export default triggerHapticFeedback;

View File

@ -1,12 +1,12 @@
import React, { createContext, useEffect, useState } from 'react';
import { Alert } from 'react-native';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
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 triggerHapticFeedback, { HapticFeedbackTypes } from './hapticFeedback';
const BlueApp = require('../BlueApp');
const BlueElectrum = require('./BlueElectrum');
const currency = require('../blue_modules/currency');
@ -177,12 +177,12 @@ export const BlueStorageProvider = ({ children }) => {
const addAndSaveWallet = async w => {
if (wallets.some(i => i.getID() === w.getID())) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
Alert.alert('', 'This wallet has been previously imported.');
return;
}
const emptyWalletLabel = new LegacyWallet().getLabel();
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
if (w.getLabel() === emptyWalletLabel) w.setLabel(loc.wallets.import_imported + ' ' + w.typeReadable);
w.setUserHasSavedExport(true);
addWallet(w);

View File

@ -1,8 +1,8 @@
import * as bitcoin from 'bitcoinjs-lib';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import alert from '../components/Alert';
import { ECPairFactory } from 'ecpair';
import ecc from '../blue_modules/noble_ecc';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback';
const ECPair = ECPairFactory(ecc);
const delay = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds));
@ -74,7 +74,7 @@ export default class PayjoinTransaction {
const result = await this.broadcastTx(txHex);
if (result === '') {
// TODO: Improve the wording of this error message
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert('Something was wrong with the payjoin transaction, the original transaction sucessfully broadcast.');
}
});

View File

@ -9,7 +9,6 @@ import AddressInput from '../../components/AddressInput';
import AmountInput from '../../components/AmountInput';
import { BitcoinUnit } from '../../models/bitcoinUnits';
import loc from '../../loc';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { AbstractWallet, HDSegwitBech32Wallet, LightningLdkWallet } from '../../class';
import { ArrowPicker } from '../../components/ArrowPicker';
import { Psbt } from 'bitcoinjs-lib';
@ -17,6 +16,7 @@ import Biometric from '../../class/biometrics';
import alert from '../../components/Alert';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const currency = require('../../blue_modules/currency');
type LdkOpenChannelProps = RouteProp<
@ -67,7 +67,7 @@ const LdkOpenChannel = (props: any) => {
(async () => {
if (psbtOpenChannelStartedTs.current ? +new Date() - psbtOpenChannelStartedTs.current >= 5 * 60 * 1000 : false) {
// its 10 min actually, but lets check 5 min just for any case
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert('Channel opening expired. Please try again');
}
@ -93,7 +93,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
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setIsLoading(false);
return alert('Channel opening expired. Please try again');
}
@ -102,14 +102,14 @@ const LdkOpenChannel = (props: any) => {
const res = await ldkWallet.fundingStateStepFinalize(tx.toHex()); // comment this out to debug
// const res = true; // debug
if (!res) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setIsLoading(false);
return alert('Something wend wrong during opening channel tx broadcast');
}
fetchAndSaveWalletTransactions(ldkWallet.getID());
await new Promise(resolve => setTimeout(resolve, 3000)); // sleep to make sure network propagates
fetchAndSaveWalletTransactions(fundingWalletID);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
// @ts-ignore: Address types later
navigate('Success', { amount: undefined });
setIsLoading(false);
@ -120,14 +120,14 @@ const LdkOpenChannel = (props: any) => {
try {
const amountSatsNumber = new BigNumber(fundingAmount.amountSats).toNumber();
if (!amountSatsNumber) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert('Amount is not valid');
}
const pubkey = remoteHostWithPubkey.split('@')[0];
const host = remoteHostWithPubkey.split('@')[1];
if (!pubkey || !host) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert('Remote node address is not valid');
}
@ -141,7 +141,7 @@ const LdkOpenChannel = (props: any) => {
if (event) {
reason += event.reason + ' ' + event.text;
}
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert('Initiating channel open failed: ' + reason);
}
@ -162,7 +162,7 @@ const LdkOpenChannel = (props: any) => {
},
});
} catch (error: any) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert(error.message);
} finally {
setIsLoading(false);

View File

@ -13,7 +13,6 @@ import {
View,
I18nManager,
} from 'react-native';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { Icon } from 'react-native-elements';
import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native';
@ -31,6 +30,7 @@ import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
import { requestCameraAuthorization } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const currency = require('../../blue_modules/currency');
const LNDCreateInvoice = () => {
@ -131,7 +131,7 @@ const LNDCreateInvoice = () => {
});
}
} else {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert(loc.wallets.add_ln_wallet_first);
goBack();
}
@ -179,7 +179,7 @@ const LNDCreateInvoice = () => {
? loc.formatString(loc.receive.maxSats, { max })
: loc.formatString(loc.receive.maxSatsFull, { max, currency: formatBalance(max, unit) });
}
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert(text);
setIsLoading(false);
return;
@ -187,7 +187,7 @@ const LNDCreateInvoice = () => {
}
const invoiceRequest = await wallet.current.addInvoice(invoiceAmount, description);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
// lets decode payreq and subscribe groundcontrol so we can receive push notification when our invoice is paid
/** @type LightningCustodianWallet */
@ -223,7 +223,7 @@ const LNDCreateInvoice = () => {
walletID: wallet.current.getID(),
});
} catch (Err) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setIsLoading(false);
alert(Err.message);
}
@ -232,7 +232,7 @@ const LNDCreateInvoice = () => {
const processLnurl = async data => {
setIsLoading(true);
if (!wallet.current) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert(loc.wallets.no_ln_wallet_error);
return goBack();
}
@ -307,7 +307,7 @@ const LNDCreateInvoice = () => {
} catch (Err) {
Keyboard.dismiss();
setIsLoading(false);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert(Err.message);
}
};

View File

@ -1,7 +1,6 @@
import React, { useContext, useEffect, useRef, useState } from 'react';
import { View, Text, ScrollView, BackHandler, TouchableOpacity, StyleSheet, I18nManager, Image } from 'react-native';
import Share from 'react-native-share';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { Icon } from 'react-native-elements';
import QRCodeComponent from '../../components/QRCodeComponent';
import { useNavigation, useNavigationState, useRoute } from '@react-navigation/native';
@ -14,6 +13,7 @@ import { SuccessView } from '../send/success';
import LNDCreateInvoice from './lndCreateInvoice';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const LNDViewInvoice = () => {
const { invoice, walletID } = useRoute().params;
@ -129,7 +129,7 @@ const LNDViewInvoice = () => {
// invoice expired :-(
fetchAndSaveWalletTransactions(walletID);
setIsFetchingInvoices(false);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
clearInterval(fetchInvoiceInterval.current);
fetchInvoiceInterval.current = undefined;
}
@ -177,7 +177,7 @@ const LNDViewInvoice = () => {
useEffect(() => {
if (invoiceStatusChanged) {
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
}
}, [invoiceStatusChanged]);

View File

@ -1,5 +1,4 @@
import React, { useState, useEffect, useContext } from 'react';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { I18nManager, Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { useNavigation, useRoute } from '@react-navigation/native';
@ -16,6 +15,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
import alert from '../../components/Alert';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const prompt = require('../../helpers/prompt');
const currency = require('../../blue_modules/currency');
@ -143,7 +143,7 @@ const LnurlPay = () => {
setPayButtonDisabled(false);
// success, probably
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
if (wallet.last_paid_invoice_result && wallet.last_paid_invoice_result.payment_preimage) {
await LN.storeSuccess(decoded.payment_hash, wallet.last_paid_invoice_result.payment_preimage);
}
@ -161,7 +161,7 @@ const LnurlPay = () => {
console.log(Err.message);
setIsLoading(false);
setPayButtonDisabled(false);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert(Err.message);
}
};

View File

@ -11,7 +11,6 @@ import {
I18nManager,
} from 'react-native';
import { Icon } from 'react-native-elements';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native';
import { BlueCard, BlueDismissKeyboardInputAccessory, BlueLoading, SafeBlueArea } from '../../BlueComponents';
@ -26,6 +25,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
import alert from '../../components/Alert';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const currency = require('../../blue_modules/currency');
const ScanLndInvoice = () => {
@ -81,7 +81,7 @@ const ScanLndInvoice = () => {
useFocusEffect(
useCallback(() => {
if (!wallet) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
goBack();
setTimeout(() => alert(loc.wallets.no_ln_wallet_error), 500);
}
@ -124,7 +124,7 @@ const ScanLndInvoice = () => {
setExpiresIn(newExpiresIn);
setDecoded(newDecoded);
} catch (Err) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
Keyboard.dismiss();
setParams({ uri: undefined });
setTimeout(() => alert(Err.message), 10);
@ -192,14 +192,14 @@ const ScanLndInvoice = () => {
const newExpiresIn = (decoded.timestamp * 1 + decoded.expiry * 1) * 1000; // ms
if (+new Date() > newExpiresIn) {
setIsLoading(false);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert(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);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert(loc.lnd.sameWalletAsInvoiceError);
}
@ -208,7 +208,7 @@ const ScanLndInvoice = () => {
} catch (Err) {
console.log(Err.message);
setIsLoading(false);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert(Err.message);
}

View File

@ -1,7 +1,6 @@
import React, { useContext, useState } from 'react';
import { ScrollView } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import navigationStyle from '../components/navigationStyle';
import { BlueLoading, SafeBlueArea, BlueCard, BlueText, BlueSpacing20 } from '../BlueComponents';
@ -9,6 +8,7 @@ import loc from '../loc';
import { BlueStorageContext } from '../blue_modules/storage-context';
import alert from '../components/Alert';
import Button from '../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback';
const prompt = require('../helpers/prompt');
const PlausibleDeniability = () => {
@ -23,7 +23,7 @@ const PlausibleDeniability = () => {
const isProvidedPasswordInUse = p1 === cachedPassword || (await isPasswordInUse(p1));
if (isProvidedPasswordInUse) {
setIsLoading(false);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert(loc.plausibledeniability.password_should_not_match);
}
if (!p1) {
@ -33,13 +33,13 @@ const PlausibleDeniability = () => {
const p2 = await prompt(loc.plausibledeniability.retype_password);
if (p1 !== p2) {
setIsLoading(false);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return alert(loc.plausibledeniability.passwords_do_not_match);
}
await createFakeStorage(p1);
await resetWallets();
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
alert(loc.plausibledeniability.success);
popToTop();
} catch {

View File

@ -32,12 +32,12 @@ import DeeplinkSchemaMatch from '../../class/deeplink-schema-match';
import loc, { formatBalance } from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import Notifications from '../../blue_modules/notifications';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { TransactionPendingIconBig } from '../../components/TransactionPendingIconBig';
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
import { SuccessView } from '../send/success';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const currency = require('../../blue_modules/currency');
const ReceiveDetails = () => {
@ -94,7 +94,7 @@ const ReceiveDetails = () => {
useEffect(() => {
if (showConfirmedBalance) {
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
}
}, [showConfirmedBalance]);
@ -124,7 +124,7 @@ const ReceiveDetails = () => {
setInitialConfirmed(balance.confirmed);
setInitialUnconfirmed(balance.unconfirmed);
setIntervalMs(25000);
ReactNativeHapticFeedback.trigger('impactHeavy', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.ImpactHeavy);
}
const txs = await BlueElectrum.getMempoolTransactionsByAddress(address2use);

View File

@ -1,7 +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 ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { useRoute, useNavigation } from '@react-navigation/native';
import * as bitcoin from 'bitcoinjs-lib';
@ -22,6 +21,7 @@ import BlueElectrum from '../../blue_modules/BlueElectrum';
import Notifications from '../../blue_modules/notifications';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const scanqr = require('../../helpers/scan-qr');
@ -64,14 +64,14 @@ const Broadcast = () => {
setTx(txid);
setBroadcastResult(BROADCAST_RESULT.success);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
Notifications.majorTomToGroundControl([], [], [txid]);
} else {
setBroadcastResult(BROADCAST_RESULT.error);
}
} catch (error) {
Alert.alert(loc.errors.error, error.message);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setBroadcastResult(BROADCAST_RESULT.error);
}
};

View File

@ -2,9 +2,7 @@ import React, { useContext, useEffect, useState } from 'react';
import { ActivityIndicator, FlatList, TouchableOpacity, StyleSheet, Switch, View } from 'react-native';
import { Text } from 'react-native-elements';
import { PayjoinClient } from 'payjoin-client';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import PropTypes from 'prop-types';
import PayjoinTransaction from '../../class/payjoin-transaction';
import { BlueText, SafeBlueArea, BlueCard } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
@ -17,6 +15,7 @@ import { useNavigation, useRoute } from '@react-navigation/native';
import alert from '../../components/Alert';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const currency = require('../../blue_modules/currency');
const BlueElectrum = require('../../blue_modules/BlueElectrum');
const Bignumber = require('bignumber.js');
@ -142,7 +141,7 @@ const Confirm = () => {
}
amount = formatBalanceWithoutSuffix(amount, BitcoinUnit.BTC, false);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
navigate('Success', {
fee: Number(fee),
amount,
@ -153,9 +152,7 @@ const Confirm = () => {
await new Promise(resolve => setTimeout(resolve, 3000)); // sleep to make sure network propagates
fetchAndSaveWalletTransactions(walletID);
} catch (error) {
ReactNativeHapticFeedback.trigger('notificationError', {
ignoreAndroidSystemSettings: false,
});
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setIsLoading(false);
alert(error.message);
}

View File

@ -19,7 +19,6 @@ import {
import { useNavigation, useRoute, useFocusEffect } from '@react-navigation/native';
import { Icon } from 'react-native-elements';
import AsyncStorage from '@react-native-async-storage/async-storage';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import RNFS from 'react-native-fs';
import BigNumber from 'bignumber.js';
import * as bitcoin from 'bitcoinjs-lib';
@ -44,6 +43,7 @@ import { requestCameraAuthorization, scanQrHelper } from '../../helpers/scan-qr'
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const currency = require('../../blue_modules/currency');
const prompt = require('../../helpers/prompt');
const fs = require('../../blue_modules/fs');
@ -486,7 +486,7 @@ const SendDetails = () => {
scrollView.current.scrollToIndex({ index });
setIsLoading(false);
Alert.alert(loc.errors.error, error);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
return;
}
}
@ -496,7 +496,7 @@ const SendDetails = () => {
} catch (Err) {
setIsLoading(false);
Alert.alert(loc.errors.error, Err.message);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
}
};
@ -1001,7 +1001,7 @@ const SendDetails = () => {
};
const onUseAllPressed = () => {
ReactNativeHapticFeedback.trigger('notificationWarning');
triggerHapticFeedback(HapticFeedbackTypes.NotificationWarning);
const message = frozenBalance > 0 ? loc.send.details_adv_full_sure_frozen : loc.send.details_adv_full_sure;
Alert.alert(
loc.send.details_adv_full,

View File

@ -1,7 +1,6 @@
import React, { useContext, useEffect, useRef, useState } from 'react';
import { ActivityIndicator, TouchableOpacity, ScrollView, View, TextInput, Linking, Platform, Text, StyleSheet } from 'react-native';
import Clipboard from '@react-native-clipboard/clipboard';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import DocumentPicker from 'react-native-document-picker';
import { useNavigation, useRoute, useIsFocused } from '@react-navigation/native';
import RNFS from 'react-native-fs';
@ -16,6 +15,7 @@ import { DynamicQRCode } from '../../components/DynamicQRCode';
import alert from '../../components/Alert';
import { requestCameraAuthorization } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const BlueElectrum = require('../../blue_modules/BlueElectrum');
const bitcoin = require('bitcoinjs-lib');
const fs = require('../../blue_modules/fs');
@ -139,12 +139,12 @@ const PsbtWithHardwareWallet = () => {
await new Promise(resolve => setTimeout(resolve, 3000)); // sleep to make sure network propagates
fetchAndSaveWalletTransactions(fromWallet.getID());
} else {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setIsLoading(false);
alert(loc.errors.broadcast);
}
} catch (error) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setIsLoading(false);
alert(error.message);
}

View File

@ -30,13 +30,13 @@ import {
BlueDismissKeyboardInputAccessory,
} from '../../BlueComponents';
import { BlueCurrentTheme } from '../../components/themes';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import WidgetCommunication from '../../blue_modules/WidgetCommunication';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import alert from '../../components/Alert';
import { requestCameraAuthorization } from '../../helpers/scan-qr';
import Button from '../../components/Button';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const BlueElectrum = require('../../blue_modules/BlueElectrum');
@ -90,7 +90,7 @@ export default class ElectrumSettings extends Component {
});
if (this.state.server) {
ReactNativeHapticFeedback.trigger('impactHeavy', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.ImpactHeavy);
Alert.alert(
loc.formatString(loc.settings.set_electrum_server_as_default, { server: this.state.server }),
'',
@ -112,7 +112,7 @@ export default class ElectrumSettings extends Component {
checkServer = async () => {
this.setState({ isLoading: true }, async () => {
const features = await BlueElectrum.serverFeatures();
ReactNativeHapticFeedback.trigger('notificationWarning', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationWarning);
alert(JSON.stringify(features, null, 2));
this.setState({ isLoading: false });
});
@ -125,7 +125,7 @@ export default class ElectrumSettings extends Component {
};
clearHistoryAlert() {
ReactNativeHapticFeedback.trigger('impactHeavy', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.ImpactHeavy);
Alert.alert(loc.settings.electrum_clear_alert_title, loc.settings.electrum_clear_alert_message, [
{ text: loc.settings.electrum_clear_alert_cancel, onPress: () => console.log('Cancel Pressed'), style: 'cancel' },
{ text: loc.settings.electrum_clear_alert_ok, onPress: () => this.clearHistory() },
@ -177,10 +177,10 @@ export default class ElectrumSettings extends Component {
// Must be running on Android
console.log(e);
}
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
alert(loc.settings.electrum_saved);
} else if (!(await BlueElectrum.testConnection(host, port, sslPort))) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert(loc.settings.electrum_error_connect);
} else {
await AsyncStorage.setItem(BlueElectrum.ELECTRUM_HOST, host);
@ -206,11 +206,11 @@ export default class ElectrumSettings extends Component {
// Must be running on Android
console.log(e);
}
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
alert(loc.settings.electrum_saved);
}
} catch (error) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
alert(error);
}
this.setState({ isLoading: false });

View File

@ -1,9 +1,6 @@
import React, { useEffect, useState, useCallback, useContext } from 'react';
import { ScrollView, Alert, TouchableOpacity, TouchableWithoutFeedback, StyleSheet } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { colors } from 'react-native-elements';
import navigationStyle from '../../components/navigationStyle';
import { BlueLoading, SafeBlueArea, BlueSpacing20, BlueCard, BlueHeaderDefaultSub, BlueText } from '../../BlueComponents';
import Biometric from '../../class/biometrics';
@ -11,6 +8,8 @@ import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import alert from '../../components/Alert';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { useTheme } from '../../components/themes';
const prompt = require('../../helpers/prompt');
const EncryptStorage = () => {
@ -19,6 +18,7 @@ const EncryptStorage = () => {
const [biometrics, setBiometrics] = useState({ isDeviceBiometricCapable: false, isBiometricsEnabled: false, biometricsType: '' });
const [storageIsEncryptedSwitchEnabled, setStorageIsEncryptedSwitchEnabled] = useState(false);
const { navigate, popToTop } = useNavigation();
const { colors } = useTheme();
const styles = StyleSheet.create({
root: {
flex: 1,
@ -52,7 +52,7 @@ const EncryptStorage = () => {
} catch (e) {
if (password) {
alert(loc._.bad_password);
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
}
setIsLoading(false);

View File

@ -13,8 +13,6 @@ import {
} from 'react-native';
import Clipboard from '@react-native-clipboard/clipboard';
import { Text } from 'react-native-elements';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { BlueCard, BlueReplaceFeeSuggestions, BlueSpacing, BlueSpacing20, BlueText, SafeBlueArea } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import { BlueCurrentTheme } from '../../components/themes';
@ -24,6 +22,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
import Notifications from '../../blue_modules/notifications';
import alert from '../../components/Alert';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const BlueElectrum = require('../../blue_modules/BlueElectrum');
const styles = StyleSheet.create({
@ -92,12 +91,12 @@ export default class CPFP extends Component {
if (result) {
this.onSuccessBroadcast();
} else {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
this.setState({ isLoading: false });
alert(loc.errors.broadcast);
}
} catch (error) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
this.setState({ isLoading: false });
alert(error.message);
}

View File

@ -2,8 +2,6 @@ import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from
import { View, ActivityIndicator, Text, TouchableOpacity, StyleSheet, BackHandler } from 'react-native';
import { Icon } from 'react-native-elements';
import { useNavigation, useRoute } from '@react-navigation/native';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { BlueCard, BlueLoading, BlueSpacing10, BlueSpacing20, BlueText, SafeBlueArea } from '../../BlueComponents';
import TransactionIncomingIcon from '../../components/icons/TransactionIncomingIcon';
import TransactionOutgoingIcon from '../../components/icons/TransactionOutgoingIcon';
@ -17,6 +15,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const buttonStatus = Object.freeze({
possible: 1,
@ -143,7 +142,7 @@ const TransactionsStatus = () => {
}
} else if (txFromElectrum.confirmations > 0) {
// now, handling a case when tx became confirmed!
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
setEta('');
setTX(prevState => {
return Object.assign({}, prevState, { confirmations: txFromElectrum.confirmations });

View File

@ -22,7 +22,6 @@ import {
LightningLdkWallet,
AbstractWallet,
} from '../../class';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { useNavigation } from '@react-navigation/native';
import { Chain } from '../../models/bitcoinUnits';
import loc from '../../loc';
@ -33,6 +32,7 @@ import useAsyncPromise from '../../hooks/useAsyncPromise';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const BlueApp = require('../../BlueApp');
const AppStorage = BlueApp.AppStorage;
const A = require('../../blue_modules/analytics');
@ -250,7 +250,7 @@ const WalletsAdd: React.FC = () => {
addWallet(w);
await saveToDisk();
A(A.ENUM.CREATED_WALLET);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
if (w.type === HDSegwitP2SHWallet.type || w.type === HDSegwitBech32Wallet.type) {
// @ts-ignore: Return later to update
navigate('PleaseBackup', {
@ -286,7 +286,7 @@ const WalletsAdd: React.FC = () => {
await saveToDisk();
A(A.ENUM.CREATED_WALLET);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
// @ts-ignore: Return later to update
navigate('PleaseBackupLdk', {
walletID: wallet.getID(),
@ -326,7 +326,7 @@ const WalletsAdd: React.FC = () => {
await saveToDisk();
A(A.ENUM.CREATED_WALLET);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
// @ts-ignore: Return later to update
navigate('PleaseBackupLNDHub', {
walletID: wallet.getID(),

View File

@ -18,8 +18,6 @@ import {
import { Icon } from 'react-native-elements';
import { useNavigation, useRoute } from '@react-navigation/native';
import { getSystemName } from 'react-native-device-info';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { BlueButtonLink, BlueFormMultiInput, BlueSpacing10, BlueSpacing20, BlueText, BlueTextCentered } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import { HDSegwitBech32Wallet, MultisigCosigner, MultisigHDWallet } from '../../class';
@ -38,6 +36,7 @@ import confirm from '../../helpers/confirm';
import { requestCameraAuthorization } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const prompt = require('../../helpers/prompt');
const A = require('../../blue_modules/analytics');
@ -168,7 +167,7 @@ const WalletsAddMultisigStep2 = () => {
addWallet(w);
await saveToDisk();
A(A.ENUM.CREATED_WALLET);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
navigation.getParent().goBack();
};

View File

@ -20,7 +20,6 @@ import {
import { BlueCard, BlueLoading, BlueSpacing10, BlueSpacing20, BlueText, SecondButton } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import { LightningCustodianWallet } from '../../class/wallets/lightning-custodian-wallet';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import Biometric from '../../class/biometrics';
import {
HDSegwitBech32Wallet,
@ -46,6 +45,7 @@ import { writeFileAndExport } from '../../blue_modules/fs';
import { PERMISSIONS, RESULTS, request } from 'react-native-permissions';
import { useTheme } from '../../components/themes';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const prompt = require('../../helpers/prompt');
@ -242,11 +242,11 @@ const WalletDetails = () => {
popToTop();
deleteWallet(wallet);
saveToDisk(true);
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
};
const presentWalletHasBalanceAlert = useCallback(async () => {
ReactNativeHapticFeedback.trigger('notificationWarning', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationWarning);
try {
const walletBalanceConfirmation = await prompt(
loc.wallets.details_delete_wallet,
@ -259,7 +259,7 @@ const WalletDetails = () => {
if (Number(walletBalanceConfirmation) === wallet.getBalance()) {
navigateToOverviewAndDeleteWallet();
} else {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
setIsLoading(false);
alert(loc.wallets.details_del_wb_err);
}
@ -461,7 +461,7 @@ const WalletDetails = () => {
};
const handleDeleteButtonTapped = () => {
ReactNativeHapticFeedback.trigger('notificationWarning', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationWarning);
Alert.alert(
loc.wallets.details_delete_wallet,
loc.wallets.details_are_you_sure,

View File

@ -1,15 +1,14 @@
import React, { useContext, useEffect, useRef } from 'react';
import { StyleSheet } from 'react-native';
import { DrawerContentScrollView } from '@react-navigation/drawer';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import PropTypes from 'prop-types';
import { useIsFocused } from '@react-navigation/native';
import { BlueHeaderDefaultMain } from '../../BlueComponents';
import WalletsCarousel from '../../components/WalletsCarousel';
import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const DrawerList = props => {
const walletsCarousel = useRef();
@ -48,7 +47,7 @@ const DrawerList = props => {
if (wallets.length > 1) {
props.navigation.navigate('ReorderWallets');
} else {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
}
};

View File

@ -2,7 +2,6 @@ import React, { useContext, useEffect, useState, useRef, useMemo } from 'react';
import { ActivityIndicator, Alert, FlatList, LayoutAnimation, StyleSheet, View } from 'react-native';
import IdleTimerManager from 'react-native-idle-timer';
import { useNavigation, useRoute } from '@react-navigation/native';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { BlueButtonLink, BlueFormLabel, BlueSpacing10, BlueSpacing20, SafeBlueArea } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import WalletToImport from '../../components/WalletToImport';
@ -13,6 +12,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
import prompt from '../../helpers/prompt';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const ImportWalletDiscovery = () => {
const navigation = useNavigation();
@ -84,7 +84,7 @@ const ImportWalletDiscovery = () => {
if (cancelled) return;
if (w.length === 1) saveWallet(w[0]); // instantly save wallet if only one has been discovered
if (w.length === 0) {
ReactNativeHapticFeedback.trigger('impactLight', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.ImpactLight);
}
})
.catch(e => {
@ -114,7 +114,7 @@ const ImportWalletDiscovery = () => {
active={selected === index}
onPress={() => {
setSelected(index);
ReactNativeHapticFeedback.trigger('selection', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.Selection);
}}
/>
);

View File

@ -16,7 +16,6 @@ import { BlueHeaderDefaultMain } from '../../BlueComponents';
import WalletsCarousel from '../../components/WalletsCarousel';
import { Icon } from 'react-native-elements';
import DeeplinkSchemaMatch from '../../class/deeplink-schema-match';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import ActionSheet from '../ActionSheet';
import loc from '../../loc';
import { FContainer, FButton } from '../../components/FloatButtons';
@ -28,6 +27,7 @@ import navigationStyle from '../../components/navigationStyle';
import { TransactionListItem } from '../../components/TransactionListItem';
import { scanQrHelper } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const A = require('../../blue_modules/analytics');
const fs = require('../../blue_modules/fs');
@ -193,7 +193,7 @@ const WalletsList = () => {
if (wallets.length > 1) {
navigate('ReorderWallets');
} else {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
}
};
@ -291,7 +291,7 @@ const WalletsList = () => {
const onBarScanned = value => {
if (!value) return;
DeeplinkSchemaMatch.navigationRouteFor({ url: value }, completionValue => {
ReactNativeHapticFeedback.trigger('impactLight', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
navigate(...completionValue);
});
};

View File

@ -3,7 +3,6 @@ import { View, Image, Text, StyleSheet, I18nManager, Pressable, useColorScheme,
import { BluePrivateBalance } from '../../BlueComponents';
import DraggableFlatList, { ScaleDecorator } from 'react-native-draggable-flatlist';
import LinearGradient from 'react-native-linear-gradient';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { useNavigation } from '@react-navigation/native';
import navigationStyle from '../../components/navigationStyle';
import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet } from '../../class';
@ -12,6 +11,7 @@ import loc, { formatBalance, transactionTimeToReadable } from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const styles = StyleSheet.create({
root: {
@ -162,15 +162,15 @@ const ReorderWallets = () => {
};
const onChangeOrder = () => {
ReactNativeHapticFeedback.trigger('impactMedium', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.ImpactMedium);
};
const onDragBegin = () => {
ReactNativeHapticFeedback.trigger('selection', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.Selection);
};
const onRelease = () => {
ReactNativeHapticFeedback.trigger('impactLight', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.ImpactLight);
};
const onDragEnd = ({ data }) => {

View File

@ -1,7 +1,6 @@
import React, { useContext, useEffect, useState } from 'react';
import { View, ActivityIndicator, Image, Text, TouchableOpacity, I18nManager, FlatList, StyleSheet } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { useRoute, useNavigation, useNavigationState } from '@react-navigation/native';
import { SafeBlueArea, BlueText, BlueSpacing20, BluePrivateBalance } from '../../BlueComponents';
@ -11,6 +10,7 @@ import loc, { formatBalance, transactionTimeToReadable } from '../../loc';
import { LightningLdkWallet, MultisigHDWallet, LightningCustodianWallet } from '../../class';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const SelectWallet = () => {
const { chainType, onWalletSelect, availableWallets, noWalletExplanationText } = useRoute().params;
@ -136,7 +136,7 @@ const SelectWallet = () => {
return (
<TouchableOpacity
onPress={() => {
ReactNativeHapticFeedback.trigger('selection', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.Selection);
onWalletSelect(item, { navigation: { pop, navigate } });
}}
accessibilityRole="button"

View File

@ -12,7 +12,6 @@ import {
View,
} from 'react-native';
import { useRoute } from '@react-navigation/native';
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import { Icon } from 'react-native-elements';
import Share from 'react-native-share';
import { BlueDoneAndDismissKeyboardInputAccessory, BlueFormLabel, BlueSpacing10, BlueSpacing20, SafeBlueArea } from '../../BlueComponents';
@ -21,6 +20,7 @@ import { FContainer, FButton } from '../../components/FloatButtons';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import loc from '../../loc';
import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
const SignVerify = () => {
const { colors } = useTheme();
@ -73,7 +73,7 @@ const SignVerify = () => {
setSignature(newSignature);
setIsShareVisible(true);
} catch (e) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
Alert.alert(loc.errors.error, e.message);
}
@ -90,10 +90,10 @@ const SignVerify = () => {
res ? loc.addresses.sign_signature_correct : loc.addresses.sign_signature_incorrect,
);
if (res) {
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
}
} catch (e) {
ReactNativeHapticFeedback.trigger('notificationError', { ignoreAndroidSystemSettings: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
Alert.alert(loc.errors.error, e.message);
}
setLoading(false);