Skip to content

Commit

Permalink
fix: update page does not vanish
Browse files Browse the repository at this point in the history
  • Loading branch information
dubisdev committed Nov 11, 2023
1 parent f666dd8 commit 8b2d8a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cerebro-cerebro-todoist",
"version": "2.8.3",
"version": "2.8.4",
"description": "Manage your Todoist tasks from CerebroApp",
"author": "David Jiménez <[email protected]> (https://dubis.dev)",
"license": "MIT",
Expand Down
16 changes: 10 additions & 6 deletions src/components/UpdatedPluginPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import lang from "lang";
const strings = lang.afterUpdate;

const updatedPlugin = ({ actions, config }) => {
const handleClick = (action) => {
action === "view"
? actions.open("https://github.com/dubisdev/cerebro-todoist/releases")
: null;
setFirstUpdateStartToFalse(config);
actions.hideWindow();
const handleClick = (action: "view" | "close") => {
if (action === "close") {
setFirstUpdateStartToFalse(config);
actions.replaceTerm("tds")
}

if (action === "view") {
actions.open("https://github.com/dubisdev/cerebro-todoist/releases")
actions.hideWindow();
}
};

return (
Expand Down
10 changes: 6 additions & 4 deletions src/services/startPageAfterUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,25 @@ export const setFirstUpdateStartToFalse = (config: CerebroConfig) => {

//delete old version entries --> filter for keys in settings.js
let result = {};
let key;
for (key in jsonConfig["cerebro-cerebro-todoist"]) {

for (let key in jsonConfig["cerebro-cerebro-todoist"]) {
if (settings.hasOwnProperty(key)) {
result[key] = jsonConfig["cerebro-cerebro-todoist"][key];
}
}

// save previous settings
jsonConfig["cerebro-cerebro-todoist"] = result;

// update firstUpdateStart
jsonConfig["cerebro-cerebro-todoist"][`firstUpdateStart${pkgJson.version}`] =
false;

config.set("plugins", jsonConfig);
};

export const getFirstUpdateStart = (config) => {
return config.get(["plugins"])["cerebro-cerebro-todoist"]?.[
export const getFirstUpdateStart = (config: CerebroConfig) => {
return config.get("plugins")["cerebro-cerebro-todoist"]?.[
`firstUpdateStart${pkgJson.version}`
];
};

0 comments on commit 8b2d8a8

Please sign in to comment.