diff --git a/app/lib/config.js b/app/lib/config.js index acd04b27..23c54742 100644 --- a/app/lib/config.js +++ b/app/lib/config.js @@ -14,8 +14,6 @@ const schema = { cleanOnHide: { type: 'boolean', default: true }, selectOnShow: { type: 'boolean', default: false }, hideOnBlur: { type: 'boolean', default: true }, - skipDonateDialog: { type: 'boolean', default: false }, - lastShownDonateDialog: { type: 'number', default: 0 }, plugins: { type: 'object', default: {} }, isMigratedPlugins: { type: 'boolean', default: false }, openAtLogin: { type: 'boolean', default: true }, diff --git a/app/main/createWindow.js b/app/main/createWindow.js index 12f830a4..d4420260 100644 --- a/app/main/createWindow.js +++ b/app/main/createWindow.js @@ -13,7 +13,6 @@ import { import buildMenu from './createWindow/buildMenu' import toggleWindow from './createWindow/toggleWindow' import handleUrl from './createWindow/handleUrl' -import * as donateDialog from './createWindow/donateDialog' export default ({ src, isDev }) => { const [x, y] = config.get('winPosition') @@ -169,10 +168,6 @@ export default ({ src, isDev }) => { }) } - if (donateDialog.shouldShow()) { - setTimeout(donateDialog.show, 1000) - } - // Save in config information, that application has been started config.set('firstStart', false) diff --git a/app/main/createWindow/AppTray.js b/app/main/createWindow/AppTray.js index 03c4f859..6b19a514 100644 --- a/app/main/createWindow/AppTray.js +++ b/app/main/createWindow/AppTray.js @@ -2,7 +2,6 @@ import { Menu, Tray, app } from 'electron' import showWindowWithTerm from './showWindowWithTerm' import toggleWindow from './toggleWindow' import checkForUpdates from './checkForUpdates' -import { donate } from './donateDialog' /** * Class that controls state of icon in menu bar @@ -61,10 +60,6 @@ export default class AppTray { click: checkForUpdates, }, separator, - { - label: 'Donate...', - click: donate - } ] if (isDev) { diff --git a/app/main/createWindow/donateDialog.js b/app/main/createWindow/donateDialog.js deleted file mode 100644 index 1474b538..00000000 --- a/app/main/createWindow/donateDialog.js +++ /dev/null @@ -1,50 +0,0 @@ -import { dialog, shell } from 'electron' -import config from 'lib/config' - -const now = () => new Date().getTime() -const twoWeeksAgo = () => now() - 1000 * 3600 * 24 * 7 - -export const donate = () => { - config.set('skipDonateDialog', true) - shell.openExternal('https://github.com/cerebroapp/cerebro#donate') -} - -export const shouldShow = () => { - // Do not show donate dialog on first start or when "dont show this message" were chosen - if (config.get('firstStart') || config.get('skipDonateDialog')) { - return false - } - - // Show on second start and once per week after first start - const lastShow = config.get('lastShownDonateDialog') - return !lastShow || twoWeeksAgo() >= lastShow -} - -export const show = () => { - config.set('lastShownDonateDialog', now()) - - const options = { - title: 'Support Cerebro development', - message: 'Developers try to make you happy with this free and open-source app. Make them happy too with your donation!', - type: 'info', - buttons: ['Close', 'Make them happy'], - cancelId: 0, - defaultId: 1, - checkboxLabel: "Don't show this message again" - } - - /** - * The function is called when user clicks in one of the buttons - * @param {number} id - * @param {boolean} checkboxChecked - */ - const callback = (id, checkboxChecked) => { - if (checkboxChecked) config.set('skipDonateDialog', true) - if (id === 1) donate() - } - - setTimeout(() => { - dialog.showMessageBox(options) - .then(({ checkboxChecked, response }) => callback(response, checkboxChecked)) - }, 1000) -}