Skip to content
Permalink
Browse files

sync deck tags

  • Loading branch information...
Manuel-777 committed Sep 29, 2019
1 parent 5f96927 commit 534dc12f12e2a4584d0e1f72d1f2003022f4b6e4
Showing with 25 additions and 0 deletions.
  1. +13 −0 window_background/background.js
  2. +12 −0 window_background/http-api.js
@@ -429,6 +429,7 @@ ipc.on("edit_tag", (event, arg) => {
const { tag, color } = arg;
setData({ tags_colors: { ...playerData.tags_colors, [tag]: color } });
store.set("tags_colors." + tag, color);
sendSettings();
});

ipc.on("delete_tag", (event, arg) => {
@@ -638,6 +639,12 @@ function syncUserData(data) {
});
if (debugLog || !firstPass) store.set("draft_index", draft_index);

if (data.settings.tags_colors) {
let newTags = data.settings.tags_colors;
setData({ tags_colors: { ...newTags } });
store.set("tags_colors", newTags);
}

setData({ courses_index, draft_index, economy_index, matches_index });
}

@@ -694,6 +701,12 @@ function startWatchingLog() {
});
}

function sendSettings() {
let tags_colors = playerData.tags_colors;
let settingsData = { tags_colors };
httpApi.httpSetSettings(settingsData);
}

let skipMatch = false;

function onLogEntryFound(entry) {
@@ -563,6 +563,17 @@ function httpSetEconomy(change) {
});
}

function httpSetSettings(settings) {
var _id = makeId(6);
settings = JSON.stringify(settings);
httpAsync.push({
reqId: _id,
method: "set_settings",
method_path: "/api/send_settings.php",
settings: settings
});
}

function httpDeleteData() {
var _id = makeId(6);
httpAsync.push({
@@ -739,6 +750,7 @@ module.exports = {
httpSetMatch,
httpSetDraft,
httpSetEconomy,
httpSetSettings,
httpDeleteData,
httpGetDatabase,
httpGetDatabaseVersion,

0 comments on commit 534dc12

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