45 lines
939 B
TypeScript
Raw Normal View History

2019-09-18 15:02:21 +09:00
import { Injectable } from '@angular/core';
import { ipcRenderer } from 'electron';
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(): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
try {
resolve(ipcRenderer.sendSync(Channel.checkForUpdates));
} catch (error) {
reject(error);
}
});
}
showImageViewer(): void {
ipcRenderer.send(Channel.showImageViewer);
}
saveFile(blob: Blob): void {
ipcRenderer.send(Channel.saveFile, blob);
}
constructor() {}
}