Commit 1ff87d19 authored by 神楽坂玲奈's avatar 神楽坂玲奈

安装完成桌面通知

parent 4fa82d94
...@@ -43,7 +43,6 @@ angular.module('maotama.controllers', []) ...@@ -43,7 +43,6 @@ angular.module('maotama.controllers', [])
} }
}, (err, numReplaced, newDoc)-> }, (err, numReplaced, newDoc)->
throw err if err throw err if err
$scope.$digest(); $scope.$digest();
$scope.install = ()-> $scope.install = ()->
...@@ -69,7 +68,7 @@ angular.module('maotama.controllers', []) ...@@ -69,7 +68,7 @@ angular.module('maotama.controllers', [])
console.log 'err: ', data console.log 'err: ', data
aria2c.on 'close', (code)-> aria2c.on 'close', (code)->
if code != 0 if code != 0
window.LOCAL_NW.desktopNotifications.notify "TODO://icon", '下载失败', "错误: #{code}" window.LOCAL_NW.desktopNotifications.notify "TODO://icon", $scope.app.name, "下载失败, 错误: #{code}"
delete $scope.installing[$scope.app.id] delete $scope.installing[$scope.app.id]
$scope.$digest(); $scope.$digest();
else else
...@@ -87,7 +86,7 @@ angular.module('maotama.controllers', []) ...@@ -87,7 +86,7 @@ angular.module('maotama.controllers', [])
file.on 'end', ()-> file.on 'end', ()->
if checksum.digest('hex') != $scope.app.download.checksum if checksum.digest('hex') != $scope.app.download.checksum
window.LOCAL_NW.desktopNotifications.notify "TODO://icon", '下载失败', "校验错误" window.LOCAL_NW.desktopNotifications.notify "TODO://icon", $scope.app.name, "校验错误"
delete $scope.installing[$scope.app.id] delete $scope.installing[$scope.app.id]
$scope.$digest(); $scope.$digest();
else else
...@@ -104,13 +103,13 @@ angular.module('maotama.controllers', []) ...@@ -104,13 +103,13 @@ angular.module('maotama.controllers', [])
console.log 'err: ', data console.log 'err: ', data
p7zip.on 'close', (code)-> p7zip.on 'close', (code)->
if code != 0 if code != 0
window.LOCAL_NW.desktopNotifications.notify "TODO://icon", '安装失败', "错误: #{code}" window.LOCAL_NW.desktopNotifications.notify "TODO://icon", $scope.app.name, "安装失败, 错误: #{code}"
delete $scope.installing[$scope.app.id] delete $scope.installing[$scope.app.id]
$scope.$digest(); $scope.$digest();
else else
$scope.add path.join(p, $scope.app.main)
delete $scope.installing[$scope.app.id] delete $scope.installing[$scope.app.id]
$scope.$digest(); window.LOCAL_NW.desktopNotifications.notify "TODO://icon", $scope.app.name, '安装完成'
$scope.add path.join(p, $scope.app.main)
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
return aria2c.on('close', function(code) { return aria2c.on('close', function(code) {
var checksum, downloaded, file; var checksum, downloaded, file;
if (code !== 0) { if (code !== 0) {
window.LOCAL_NW.desktopNotifications.notify("TODO://icon", '下载失败', "错误: " + code); window.LOCAL_NW.desktopNotifications.notify("TODO://icon", $scope.app.name, "下载失败, 错误: " + code);
delete $scope.installing[$scope.app.id]; delete $scope.installing[$scope.app.id];
return $scope.$digest(); return $scope.$digest();
} else { } else {
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
return file.on('end', function() { return file.on('end', function() {
var p; var p;
if (checksum.digest('hex') !== $scope.app.download.checksum) { if (checksum.digest('hex') !== $scope.app.download.checksum) {
window.LOCAL_NW.desktopNotifications.notify("TODO://icon", '下载失败', "校验错误"); window.LOCAL_NW.desktopNotifications.notify("TODO://icon", $scope.app.name, "校验错误");
delete $scope.installing[$scope.app.id]; delete $scope.installing[$scope.app.id];
return $scope.$digest(); return $scope.$digest();
} else { } else {
...@@ -139,13 +139,13 @@ ...@@ -139,13 +139,13 @@
}); });
return p7zip.on('close', function(code) { return p7zip.on('close', function(code) {
if (code !== 0) { if (code !== 0) {
window.LOCAL_NW.desktopNotifications.notify("TODO://icon", '安装失败', "错误: " + code); window.LOCAL_NW.desktopNotifications.notify("TODO://icon", $scope.app.name, "安装失败, 错误: " + code);
delete $scope.installing[$scope.app.id]; delete $scope.installing[$scope.app.id];
return $scope.$digest(); return $scope.$digest();
} else { } else {
$scope.add(path.join(p, $scope.app.main));
delete $scope.installing[$scope.app.id]; delete $scope.installing[$scope.app.id];
return $scope.$digest(); window.LOCAL_NW.desktopNotifications.notify("TODO://icon", $scope.app.name, '安装完成');
return $scope.add(path.join(p, $scope.app.main));
} }
}); });
}); });
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment