2024-04-26 04:02:22 +02:00
|
|
|
import { Alert as RNAlert } from 'react-native';
|
2024-05-20 11:54:13 +02:00
|
|
|
|
2024-04-26 04:02:22 +02:00
|
|
|
import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapticFeedback';
|
2024-05-20 11:54:13 +02:00
|
|
|
import loc from '../loc';
|
2024-04-26 04:02:22 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2021-10-04 08:02:33 +02:00
|
|
|
};
|
2024-02-07 20:24:24 +01:00
|
|
|
export default presentAlert;
|