Skip to content

Commit

Permalink
v1.6.0 - 支持下载完成桌面通知
Browse files Browse the repository at this point in the history
  • Loading branch information
Xmader committed Sep 27, 2018
1 parent c8da19b commit d329e94
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"semi": [
"warn",
"never"
]
],
"no-console": "off"
}
}
6 changes: 4 additions & 2 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ app.on('ready', function () {
height: 600,
minWidth: 400,
minHeight: 400,
icon: path.join(__dirname, 'assets/AriaNg.png'),
icon: path.join(__dirname, 'assets', 'AriaNg.png'),
show: false,
webPreferences: {
nodeIntegration: false,
Expand Down Expand Up @@ -98,5 +98,7 @@ ipcMain.on("right_btn", () => {
})

ipcMain.on("show_progress_bar", (event, n) => {
mainWindow.setProgressBar(n ? n : -1)
if (mainWindow && mainWindow.setProgressBar) {
mainWindow.setProgressBar(n ? n : -1)
}
})
7 changes: 7 additions & 0 deletions app/native_node_modules/index.js

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

11 changes: 11 additions & 0 deletions app/native_node_modules/package.json

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

17 changes: 17 additions & 0 deletions app/notify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require("path")

const { notifier } = require("./native_node_modules")

const notify = (title, message) => {
notifier.notify({
title,
message,
icon: path.join(__dirname, "assets", "AriaNg.png"),
// appID:"github.xmader.ariang_gui"
}, (err) => {
if (err)
console.error(err)
})
}

module.exports = notify
3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ariang-gui",
"version": "1.5.1",
"version": "1.6.0",
"private": true,
"description": "AriaNg GUI",
"main": "app.js",
Expand All @@ -16,6 +16,7 @@
"scripts": {
"dev": "electron . dev",
"start": "electron .",
"install": "cd native_node_modules && npm install",
"build-win32": "sh ./packager.sh win32 ia32",
"build-win64": "sh ./packager.sh win32 x64",
"build-darwin64": "sh ./packager.sh darwin x64 #只能在*unix系统上运行此打包脚本",
Expand Down
2 changes: 1 addition & 1 deletion app/pages/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/pages/index.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ css/aria-ng-c609d5bccb.min.css
css/bootstrap-3.3.7.min.css
css/plugins-acd93e5a25.min.css
js/angular-packages-1.6.10.min.js
js/aria-ng-371e36fd1f.min.js
js/aria-ng-ab85475478.min.js
js/bootstrap-3.3.7.min.js
js/echarts-common-3.8.5.min.js
js/jquery-3.3.1.min.js
Expand All @@ -20,4 +20,4 @@ NETWORK:
SETTINGS:
prefer-online

# hash: 8f23965dd3673743b5b4ce21c3b1ebed6ef2448d6d1af4781d9632b7933c35ef
# hash: 8a9e099f2f83367e39ad90cb05160f0b699bae76c0a330c1661eb153a988c78b
12 changes: 0 additions & 12 deletions app/pages/js/aria-ng-371e36fd1f.min.js

This file was deleted.

12 changes: 12 additions & 0 deletions app/pages/js/aria-ng-ab85475478.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion app/pages/langs/zh_Hans.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Tips: You can use the "noprefix" tag to ignore the prefix, "nosuffix" tag ignore
Example: ${downspeed:noprefix:nosuffix:scale\=1}=示例: ${downspeed:noprefix:nosuffix:scale\=1}
Page Title Refresh Interval=页面标题刷新间隔
Enable Browser Notification=启用浏览器通知
Enable Desktop Notification=启用桌面通知
Aria2 RPC Alias=Aria2 RPC 别名
Aria2 RPC Address=Aria2 RPC 地址
Aria2 RPC Protocol=Aria2 RPC 协议
Expand Down Expand Up @@ -169,7 +170,7 @@ Are you sure you want to import all settings?=您是否要导入所有设置?
Invalid settings data format!=无效的设置数据格式!
Data has been copied to clipboard.=数据已经复制到剪贴板中.
Supported Placeholder=支持的占位符
AriaNg Title=AriaNg 标题
AriaNg Title=AriaNg GUI 标题
Downloading Count=正在下载数量
Waiting Count=正在等待数量
Stopped Count=已停止数量
Expand Down
3 changes: 2 additions & 1 deletion app/pages/langs/zh_Hant.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Tips: You can use the "noprefix" tag to ignore the prefix, "nosuffix" tag ignore
Example: ${downspeed:noprefix:nosuffix:scale\=1}=示例: ${downspeed:noprefix:nosuffix:scale\=1}
Page Title Refresh Interval=頁面標題重新整理間隔
Enable Browser Notification=啟用瀏覽器通知
Enable Desktop Notification=啟用桌面通知
Aria2 RPC Alias=Aria2 RPC 別名
Aria2 RPC Address=Aria2 RPC 位址
Aria2 RPC Protocol=Aria2 RPC 協定
Expand Down Expand Up @@ -169,7 +170,7 @@ Are you sure you want to import all settings?=您是否要匯入所有設定?
Invalid settings data format!=無效的設定資料格式!
Data has been copied to clipboard.=資料已經複製到剪貼簿中.
Supported Placeholder=支援的預留位置
AriaNg Title=AriaNg 標題
AriaNg Title=AriaNg GUI 標題
Downloading Count=正在下載數量
Waiting Count=正在等待數量
Stopped Count=已停止數量
Expand Down
19 changes: 12 additions & 7 deletions app/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,25 @@

const fs = require("fs")
const { resolve } = require("path")
const { ipcRenderer, shell, remote: { app } } = require('electron');
const check_update = require('./check_update.js')
const { ipcRenderer, shell, remote: { app } } = require("electron")

const check_update = require("./check_update.js")
const notify = require("./notify.js")

// 支持桌面提醒
window.notify = notify

// 添加右键菜单
window.addEventListener('contextmenu', (e) => {
e.preventDefault();
window.addEventListener("contextmenu", (e) => {
e.preventDefault()

let activeElement = document.activeElement
let tagName = activeElement.tagName.toLocaleLowerCase()

if (tagName == "input" || tagName == "textarea") {
ipcRenderer.send('right_btn');
ipcRenderer.send("right_btn")
}
});
})

// 检查版本更新
check_update()
Expand Down Expand Up @@ -59,7 +64,7 @@ const show_progress_bar = () => { // 显示任务栏进度条
let total_progress = tasks.reduce((total, task) => total + (task.completedLength / task.totalLength), 0)

let progress = (tasks.length > 0) ? (total_progress / tasks.length) : -1
ipcRenderer.send('show_progress_bar', progress)
ipcRenderer.send("show_progress_bar", progress)
})
}

Expand Down

0 comments on commit d329e94

Please sign in to comment.