Skip to content

Commit

Permalink
feat: deprecate experiments
Browse files Browse the repository at this point in the history
This adds mechanism for deprecating experiments, using npm-on-ipfs as an
example.

We keep showing experiment if it is enabled, but hide it from UI if it
is disabled, which will slowly phase it out.

License: MIT
Signed-off-by: Marcin Rataj <[email protected]>
  • Loading branch information
lidel committed Feb 23, 2021
1 parent 1e00334 commit 1757874
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ const CONFIG_KEYS = [
NAMESYS_PUBSUB_KEY
]

// We show them if user enabled them before, but hide when off
const DEPRECATED_KEYS = new Set([
NPM_IPFS_KEY // superseded by https://github.com/forestpm/forest
])

function buildCheckbox (key, label) {
return {
id: key,
label: i18n.t(label),
click: () => { ipcMain.emit(`toggle_${key}`) },
type: 'checkbox',
visible: !DEPRECATED_KEYS.has(key),
checked: false
}
}
Expand Down Expand Up @@ -336,7 +342,9 @@ module.exports = function (ctx) {

// Update configuration checkboxes.
for (const key of CONFIG_KEYS) {
menu.getMenuItemById(key).checked = store.get(key, false)
const enabled = store.get(key, false)
menu.getMenuItemById(key).checked = enabled
menu.getMenuItemById(key).visible = !DEPRECATED_KEYS.has(key) || enabled
}

if (!IS_MAC && !IS_WIN) {
Expand Down

0 comments on commit 1757874

Please sign in to comment.