Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
RoderickQiu committed Apr 21, 2019
1 parent 56f574f commit bacaf76
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 78 deletions.
4 changes: 3 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,7 @@
"loadingtip3": "this link",
"loadingtip4": "to see the offline guide. (might be out of date)",
"settingstip": "Some tips about wnr settings",
"settingstipmsg": "Welcome to settings! When you change one field, the setting will automatially be set. Some settings needs a restart."
"settingstipmsg": "Welcome to settings! When you change one field, the setting will automatially be set. Some settings needs a restart.",
"alarmtip": "Long time no see... ",
"alarmtipmsg": "Open wnr and have a healthier schedule! "
}
4 changes: 3 additions & 1 deletion locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,7 @@
"loadingtip3": "此链接",
"loadingtip4": "加载本地帮助手册。(本地帮助手册可能已经过时。)",
"settingstip": "你似乎是第一次打开设置",
"settingstipmsg": "很好,你已经迈出了第一步。wnr的设置组件非常强大,可以丰富和方便你的wnr体验。所有设置都会自动生效,部分组件在被设置后会自动重启程序以应用设置,望知悉。"
"settingstipmsg": "很好,你已经迈出了第一步。wnr的设置组件非常强大,可以丰富和方便你的wnr体验。所有设置都会自动生效,部分组件在被设置后会自动重启程序以应用设置,望知悉。",
"alarmtip": "你已经很久没有开始一个新计划了。",
"alarmtipmsg": "打开wnr,开始一个新计划吧!"
}
40 changes: 34 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var i18n = require("i18n")
// be closed automatically when the JavaScript object is garbage collected.
let win, settingsWin = null, aboutWin = null, tourWin = null;
let tray = null, contextMenu = null
let resetAlarm = null

app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required')// 允许自动播放音频

Expand Down Expand Up @@ -192,9 +193,11 @@ ipcMain.on('warninggiver-workend', function () {
win.show();
win.focus();
win.center();
win.once('focus', () => win.flashFrame(false));
win.flashFrame(true);
if (store.get("fullscreen") == true) win.setFullScreen(true);
if (store.get("fullscreen") == true) {
if (store.get("top") != true) win.setAlwaysOnTop(true);//全屏时恒定最上层
win.setFullScreen(true);
}
setTimeout(function () {
dialog.showMessageBox(win, {
title: i18n.__('worktimeend'),
Expand All @@ -210,9 +213,11 @@ ipcMain.on('warninggiver-workend', function () {

ipcMain.on('warninggiver-restend', function () {
if (win != null) {
win.once('focus', () => win.flashFrame(false));
win.flashFrame(true);
if (win.isFullScreen()) win.setFullScreen(false);
if (store.get("fullscreen") == true) {
if (store.get("top") != true) win.setAlwaysOnTop(false);//取消不需要的恒定最上层
win.setFullScreen(false);
}
setTimeout(function () {
dialog.showMessageBox(win, {
title: i18n.__('resttimeend'),
Expand All @@ -228,9 +233,11 @@ ipcMain.on('warninggiver-restend', function () {

ipcMain.on('warninggiver-allend', function () {
if (win != null) {
win.once('focus', () => win.flashFrame(false));
win.flashFrame(true);
if (win.isFullScreen()) win.setFullScreen(false);
if (store.get("fullscreen") == true) {
if (store.get("top") != true) win.setAlwaysOnTop(false);//取消不需要的恒定最上层
win.setFullScreen(false);
}
setTimeout(function () {
dialog.showMessageBox(win, {
title: i18n.__('allend'),
Expand All @@ -240,6 +247,14 @@ ipcMain.on('warninggiver-allend', function () {
if (!win.isVisible()) win.show()
});
}, 100)
resetAlarm = setTimeout(function () {
dialog.showMessageBox(win, {
title: i18n.__('alarmtip'),
type: "info",
message: i18n.__('alarmtipmsg'),
silent: true
});
}, 1200000)
}
})

Expand Down Expand Up @@ -357,10 +372,23 @@ ipcMain.on("timer-win", function (event, message) {
globalShortcut.register('CommandOrControl+Shift+Alt+' + store.get('hotkey2'), () => {
win.webContents.send('startorstop');
})
if (resetAlarm) {
clearTimeout(resetAlarm);
}
} else {
if (tray != null) {
contextMenu.items[2].enabled = false;
}
globalShortcut.unregister('CommandOrControl+Shift+Alt+' + store.get('hotkey2'));
if (!resetAlarm) {
resetAlarm = setTimeout(function () {
dialog.showMessageBox(win, {
title: i18n.__('alarmtip'),
type: "info",
message: i18n.__('alarmtipmsg'),
silent: true
});
}, 1200000)
}
}
})
105 changes: 38 additions & 67 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wnr",
"version": "1.2.5",
"update-use-version": "12577",
"version": "1.2.6",
"update-use-version": "12677",
"description": "It's a timer app with strong expansibility for computers. The name is a abbr of \"Work and Rest\".",
"main": "main.js",
"scripts": {
Expand All @@ -18,14 +18,15 @@
"license": "MIT",
"homepage": "https://wnr.scris.top",
"appId": "com.scrisstudio.wnr",
"copyright": "© Roderick Qiu",
"copyright": "(c) Roderick Qiu",
"productName": "wnr",
"dependencies": {
"ajv": "^6.10.0",
"auto-launch": "^5.0.5",
"cheerio": "^1.0.0-rc.2",
"electron-store": "^3.0.0",
"i18n": "^0.8.3",
"js-yaml": "^3.13.1",
"request": "^2.88.0"
},
"devDependencies": {
Expand Down

0 comments on commit bacaf76

Please sign in to comment.