import { Injectable } from '@angular/core'; import { ipcRenderer } from 'electron'; import { Observable } from 'rxjs'; import { NativeService } from '@ucap-webmessenger/native'; import { Channel } from '../types/channel.type'; export class ElectronNativeService implements NativeService { showNotify( roomSeq: number, title: string, contents: string, image: string, useSound: boolean ): void { ipcRenderer.send( Channel.showNotify, roomSeq, title, contents, image, useSound ); } checkForUpdates(): Observable { return new Observable(subscriber => { try { subscriber.next(ipcRenderer.sendSync(Channel.checkForUpdates)); } catch (error) { subscriber.error(error); } finally { subscriber.complete(); } }); } showImageViewer(): void { ipcRenderer.send(Channel.showImageViewer); } saveFile(blob: Blob): void { ipcRenderer.send(Channel.saveFile, blob); } constructor() {} }