mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
ADD: Optional haptic feedback parameter for Alerts
This commit is contained in:
parent
f74e0890cc
commit
ce5963b891
@ -185,7 +185,10 @@ export const BlueStorageProvider = ({ children }: { children: React.ReactNode })
|
||||
addWallet(w);
|
||||
await saveToDisk();
|
||||
A(A.ENUM.CREATED_WALLET);
|
||||
presentAlert({ message: w.type === WatchOnlyWallet.type ? loc.wallets.import_success_watchonly : loc.wallets.import_success });
|
||||
presentAlert({
|
||||
hapticFeedback: HapticFeedbackTypes.ImpactHeavy,
|
||||
message: w.type === WatchOnlyWallet.type ? loc.wallets.import_success_watchonly : loc.wallets.import_success,
|
||||
});
|
||||
// @ts-ignore need to type notifications first
|
||||
Notifications.majorTomToGroundControl(w.getAllExternalAddresses(), [], []);
|
||||
// start balance fetching at the background
|
||||
|
@ -1,6 +1,29 @@
|
||||
import { Alert } from 'react-native';
|
||||
import { Alert as RNAlert } from 'react-native';
|
||||
import loc from '../loc';
|
||||
const presentAlert = ({ title, message }: { title?: string; message: string }) => {
|
||||
Alert.alert(title ?? loc.alert.default, message);
|
||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback';
|
||||
|
||||
export enum AlertType {
|
||||
Alert,
|
||||
Toast,
|
||||
}
|
||||
const presentAlert = ({
|
||||
title,
|
||||
message,
|
||||
type = AlertType.Alert,
|
||||
hapticFeedback,
|
||||
}: {
|
||||
title?: string;
|
||||
message: string;
|
||||
type?: AlertType;
|
||||
hapticFeedback?: HapticFeedbackTypes;
|
||||
}) => {
|
||||
if (hapticFeedback) {
|
||||
triggerHapticFeedback(hapticFeedback);
|
||||
}
|
||||
switch (type) {
|
||||
default:
|
||||
RNAlert.alert(title ?? loc.alert.default, message);
|
||||
break;
|
||||
}
|
||||
};
|
||||
export default presentAlert;
|
||||
|
Loading…
Reference in New Issue
Block a user