Skip to content
Permalink
Browse files

Merge pull request #391 from lusbenjamin/taskbar-progress

Taskbar Progress
  • Loading branch information...
Manuel-777 committed May 26, 2019
2 parents 5dd6a8a + c5fbc77 commit e406c400e6dff995dd12c19b7834b72e5852a82a
Showing with 29 additions and 11 deletions.
  1. +5 −0 main.js
  2. +17 −9 window_background/background.js
  3. +7 −2 window_background/http-api.js
@@ -188,6 +188,11 @@ function startApp() {

case "popup":
mainWindow.webContents.send("popup", arg.text, arg.time);
if (arg.progress) {
// set progress to <0 to disable
// set progress to >1 for indeterminate time
mainWindow.setProgressBar(arg.progress);
}
break;

case "renderer_window_minimize":
@@ -359,7 +359,8 @@ ipc.on("auto_login", () => {
tokenAuth = rstore.get("token");
ipc_send("popup", {
text: "Logging in automatically...",
time: 0
time: 0,
progress: 2
});
if (rSettings.remember_me) {
httpApi.httpAuth(rstore.get("email"), HIDDEN_PW);
@@ -732,7 +733,8 @@ function loadPlayerConfig(playerId, serverData = undefined) {
for (let i = 0; i < history.matches.length; i++) {
ipc_send("popup", {
text: "Reading history: " + i + " / " + history.matches.length,
time: 0
time: 0,
progress: i / history.matches.length
});
id = history.matches[i];
if (id != null) {
@@ -748,7 +750,8 @@ function loadPlayerConfig(playerId, serverData = undefined) {
for (let i = 0; i < drafts.matches.length; i++) {
ipc_send("popup", {
text: "Reading drafts: " + i + " / " + drafts.matches.length,
time: 0
time: 0,
progress: i / drafts.matches.length
});
id = drafts.matches[i];

@@ -768,7 +771,8 @@ function loadPlayerConfig(playerId, serverData = undefined) {
for (let i = 0; i < events.courses.length; i++) {
ipc_send("popup", {
text: "Reading events: " + i + " / " + events.courses.length,
time: 0
time: 0,
progress: i / events.courses.length
});
id = events.courses[i];

@@ -785,7 +789,8 @@ function loadPlayerConfig(playerId, serverData = undefined) {
for (let i = 0; i < economy.changes.length; i++) {
ipc_send("popup", {
text: "Reading economy: " + i + " / " + economy.changes.length,
time: 0
time: 0,
progress: i / economy.changes.length
});
id = economy.changes[i];

@@ -801,7 +806,8 @@ function loadPlayerConfig(playerId, serverData = undefined) {
for (let i = 0; i < decks.index.length; i++) {
ipc_send("popup", {
text: "Reading decks: " + i + " / " + decks.index.length,
time: 0
time: 0,
progress: i / decks.index.length
});
id = decks.index[i];

@@ -1993,9 +1999,11 @@ function saveDraft() {
//
function updateLoading(entry) {
if (firstPass) {
const completion = entry.position / entry.size;
ipc_send("popup", {
text: `Reading log: ${Math.round((100 / entry.size) * entry.position)}%`,
time: 0
text: `Reading log: ${Math.round(100 * completion)}%`,
time: 0,
progress: completion
});
}
}
@@ -2033,7 +2041,7 @@ function finishLoading() {
playerData.rank.limited.tier
);
}
ipc_send("popup", { text: `Reading log: 100%`, time: 1000 });
ipc_send("popup", { text: `Reading log: 100%`, time: 1000, progress: -1 });
logReadEnd = new Date();
let logReadElapsed = (logReadEnd - logReadStart) / 1000;
ipc_send("ipc_log", `Log read in ${logReadElapsed}s`);
@@ -111,6 +111,11 @@ function httpBasic() {
path: "/database/database.json",
method: "GET"
};
ipc_send("popup", {
text: "Downloading metadata...",
time: 0,
progress: 2
});
} else if (_headers.method == "get_ladder_decks") {
options = {
protocol: "https:",
@@ -318,7 +323,8 @@ function httpBasic() {
cardsDb.set(parsedResult);
ipc_send("popup", {
text: "Metadata: Ok",
time: 1000
time: 1000,
progress: -1
});
ipc_send("set_db", results);
ipc_send("show_login", true);
@@ -555,7 +561,6 @@ function httpDeleteData() {

function httpGetDatabase() {
var _id = makeId(6);
ipc_send("popup", { text: "Downloading metadata", time: 0 });
httpAsync.push({ reqId: _id, method: "get_database" });
}

0 comments on commit e406c40

Please sign in to comment.
You can’t perform that action at this time.