Send desktop notifications when a download has completed
This commit is contained in:
parent
0214422e6b
commit
1b88e70d74
1 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,8 @@ import setBadge from "util/setBadge";
|
||||||
import setProgressBar from "util/setProgressBar";
|
import setProgressBar from "util/setProgressBar";
|
||||||
import batchActions from "util/batchActions";
|
import batchActions from "util/batchActions";
|
||||||
|
|
||||||
|
const { ipcRenderer } = require("electron");
|
||||||
|
|
||||||
export function doResolveUri(uri) {
|
export function doResolveUri(uri) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
uri = lbryuri.normalize(uri);
|
uri = lbryuri.normalize(uri);
|
||||||
|
@ -128,8 +130,17 @@ export function doUpdateLoadStatus(uri, outpoint) {
|
||||||
|
|
||||||
const badgeNumber = selectBadgeNumber(getState());
|
const badgeNumber = selectBadgeNumber(getState());
|
||||||
setBadge(badgeNumber === 0 ? "" : `${badgeNumber}`);
|
setBadge(badgeNumber === 0 ? "" : `${badgeNumber}`);
|
||||||
|
|
||||||
const totalProgress = selectTotalDownloadProgress(getState());
|
const totalProgress = selectTotalDownloadProgress(getState());
|
||||||
setProgressBar(totalProgress);
|
setProgressBar(totalProgress);
|
||||||
|
|
||||||
|
const notif = new window.Notification("Download Complete", {
|
||||||
|
body: fileInfo.metadata.stream.metadata.title,
|
||||||
|
silent: false,
|
||||||
|
});
|
||||||
|
notif.onclick = () => {
|
||||||
|
ipcRenderer.send("focusWindow", "main");
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
// ready to play
|
// ready to play
|
||||||
const { total_bytes, written_bytes } = fileInfo;
|
const { total_bytes, written_bytes } = fileInfo;
|
||||||
|
|
Loading…
Reference in a new issue