This commit is contained in:
gaoshuaixing
2023-05-12 15:55:05 +08:00
parent 6ec477a19c
commit 863e98f4df
9 changed files with 131 additions and 129 deletions

View File

@@ -190,7 +190,7 @@ class OsController extends Controller {
* 创建系统通知
*/
sendNotification (args, event) {
const { title, subtitle, body, silent, clickEvent, closeEvent} = args;
const { title, subtitle, body, silent} = args;
if (!Notification.isSupported()) {
return '当前系统不支持通知';
@@ -210,7 +210,7 @@ class OsController extends Controller {
options.silent = silent;
}
this.service.os.createNotification(clickEvent, closeEvent, event);
this.service.os.createNotification(options, event);
return true
}

View File

@@ -24,7 +24,7 @@ class OsService extends Service {
// electron 实验性功能,慎用
this.myBrowserView = new BrowserView();
Electron.mainWindow.setBrowserView(this.myBrowserView);
myBrowserView.setBounds({
this.myBrowserView.setBounds({
x: 300,
y: 170,
width: 650,
@@ -45,11 +45,11 @@ class OsService extends Service {
/**
* createNotification
*/
createNotification(clickEvent, closeEvent, event) {
createNotification(options, event) {
const channel = 'controller.os.sendNotification';
this.myNotification = new Notification(options);
if (clickEvent) {
if (options.clickEvent) {
this.myNotification.on('click', (e) => {
let data = {
type: 'click',
@@ -59,7 +59,7 @@ class OsService extends Service {
});
}
if (closeEvent) {
if (options.closeEvent) {
this.myNotification.on('close', (e) => {
let data = {
type: 'close',