Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/notification-manager/src/providers/ |
Upload File : |
import { Type } from 'main.core'; import BaseProvider from './base'; import DesktopProvider from './desktop'; import Notification from '../notification/notification'; import NotificationAction from '../notification/notification-action'; export default class LinuxProvider extends DesktopProvider { convertNotificationToNative(notification: Notification): string { if (!Type.isStringFilled(notification.getId())) { throw new Error(`NotificationManager: You cannot send a notification without an ID.`); } const notificationUid = notification.getUid(); BXDesktopSystem.NotificationCreate(notificationUid); if (Type.isStringFilled(notification.getTitle())) { BXDesktopSystem.NotificationAddText(notificationUid, notification.getTitle()); } if (Type.isStringFilled(notification.getText())) { BXDesktopSystem.NotificationAddText(notificationUid, notification.getText()); } if (Type.isStringFilled(notification.getIcon())) { BXDesktopSystem.NotificationAddImage(notificationUid, notification.getIcon()); } if ( notification.getInputPlaceholderText() && Type.isString(notification.getInputPlaceholderText()) ) { BXDesktopSystem.NotificationAddInput( notificationUid, notification.getInputPlaceholderText(), NotificationAction.USER_INPUT, ); } if (notification.getButton1Text() && Type.isStringFilled(notification.getButton1Text())) { BXDesktopSystem.NotificationAddAction( notificationUid, notification.getButton1Text(), NotificationAction.BUTTON_1, ); } if (notification.getButton2Text() && Type.isStringFilled(notification.getButton2Text())) { BXDesktopSystem.NotificationAddAction( notificationUid, notification.getButton2Text(), NotificationAction.BUTTON_2, ); } BXDesktopSystem.NotificationSetExpiration(notificationUid, BaseProvider.NOTIFICATION_LIFETIME); return notificationUid; } }