A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

4 years ago
  1. // @ts-ignore
  2. import * as alertify from "alertifyjs";
  3. import { NotificationService } from "./NotificationService";
  4. import log = require("loglevel");
  5. import bootbox = require("bootbox");
  6. export class AlertifyNotificationService implements NotificationService {
  7. private readonly _alertify = alertify;
  8. constructor() {
  9. this._alertify.set("notifier", "position", "top-center");
  10. }
  11. success(message: string): void {
  12. this._alertify.success(message);
  13. }
  14. error(message: string): void {
  15. this._alertify.error(message);
  16. }
  17. errorWithDelay(message: string, delay: number): void {
  18. const _delay = this._alertify.get("notifier", "delay");
  19. this._alertify.set("notifier", "delay", delay);
  20. this._alertify.error(message);
  21. this._alertify.set("notifier", "delay", _delay);
  22. }
  23. warning(message: string): void {
  24. this._alertify.warning(message);
  25. }
  26. message(message: string): void {
  27. this._alertify.message(message);
  28. }
  29. passphrasePrompt(
  30. cb: (result: string) => void
  31. ): void {
  32. bootbox.prompt({
  33. title: "Please enter the passphrase",
  34. inputType: "password",
  35. callback: cb
  36. });
  37. }
  38. }