aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-02 11:43:28 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-02 11:43:28 +0200
commit098c46e88349d36d44a479f47a6c8b5516f12879 (patch)
tree239879acfad1a17653fa15d49af0750ec08fbe43
parent Add @xthursdayx as a contributor (diff)
downloadferdium-app-098c46e88349d36d44a479f47a6c8b5516f12879.tar.gz
ferdium-app-098c46e88349d36d44a479f47a6c8b5516f12879.tar.zst
ferdium-app-098c46e88349d36d44a479f47a6c8b5516f12879.zip
Implement #87
-rw-r--r--src/components/settings/settings/EditSettingsForm.js5
-rw-r--r--src/config.js1
-rw-r--r--src/containers/settings/EditSettingsScreen.js12
-rw-r--r--src/electron/ipc-api/autoUpdate.js53
-rw-r--r--src/i18n/locales/defaultMessages.json21
-rw-r--r--src/i18n/locales/en-US.json1
-rw-r--r--src/i18n/messages/src/containers/settings/EditSettingsScreen.json21
7 files changed, 85 insertions, 29 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index 1d2383125..75f0d9d23 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -146,6 +146,7 @@ export default @observer class EditSettingsForm extends Component {
146 isTodosEnabled: PropTypes.bool.isRequired, 146 isTodosEnabled: PropTypes.bool.isRequired,
147 isWorkspaceEnabled: PropTypes.bool.isRequired, 147 isWorkspaceEnabled: PropTypes.bool.isRequired,
148 server: PropTypes.string.isRequired, 148 server: PropTypes.string.isRequired,
149 noUpdates: PropTypes.bool.isRequired,
149 }; 150 };
150 151
151 static contextTypes = { 152 static contextTypes = {
@@ -179,6 +180,7 @@ export default @observer class EditSettingsForm extends Component {
179 isTodosEnabled, 180 isTodosEnabled,
180 isWorkspaceEnabled, 181 isWorkspaceEnabled,
181 server, 182 server,
183 noUpdates,
182 } = this.props; 184 } = this.props;
183 const { intl } = this.context; 185 const { intl } = this.context;
184 186
@@ -412,7 +414,7 @@ export default @observer class EditSettingsForm extends Component {
412 buttonType="secondary" 414 buttonType="secondary"
413 label={intl.formatMessage(updateButtonLabelMessage)} 415 label={intl.formatMessage(updateButtonLabelMessage)}
414 onClick={checkForUpdates} 416 onClick={checkForUpdates}
415 disabled={isCheckingForUpdates || isUpdateAvailable} 417 disabled={noUpdates || isCheckingForUpdates || isUpdateAvailable}
416 loaded={!isCheckingForUpdates || !isUpdateAvailable} 418 loaded={!isCheckingForUpdates || !isUpdateAvailable}
417 /> 419 />
418 )} 420 )}
@@ -421,6 +423,7 @@ export default @observer class EditSettingsForm extends Component {
421 )} 423 )}
422 <br /> 424 <br />
423 <Toggle field={form.$('beta')} /> 425 <Toggle field={form.$('beta')} />
426 <Toggle field={form.$('noUpdates')} />
424 {intl.formatMessage(messages.currentVersion)} 427 {intl.formatMessage(messages.currentVersion)}
425 {' '} 428 {' '}
426 {remote.app.getVersion()} 429 {remote.app.getVersion()}
diff --git a/src/config.js b/src/config.js
index ea36be1f9..c6c31ce23 100644
--- a/src/config.js
+++ b/src/config.js
@@ -63,6 +63,7 @@ export const DEFAULT_APP_SETTINGS = {
63 scheduledDNDStart: '17:00', 63 scheduledDNDStart: '17:00',
64 scheduledDNDEnd: '09:00', 64 scheduledDNDEnd: '09:00',
65 hibernate: false, 65 hibernate: false,
66 noUpdates: false,
66}; 67};
67 68
68export const DEFAULT_FEATURES_CONFIG = { 69export const DEFAULT_FEATURES_CONFIG = {
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index 962dc1b65..463a290d2 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -109,6 +109,10 @@ const messages = defineMessages({
109 id: 'settings.app.form.beta', 109 id: 'settings.app.form.beta',
110 defaultMessage: '!!!Include beta versions', 110 defaultMessage: '!!!Include beta versions',
111 }, 111 },
112 noUpdates: {
113 id: 'settings.app.form.noUpdates',
114 defaultMessage: '!!!Disable updates',
115 },
112 enableTodos: { 116 enableTodos: {
113 id: 'settings.app.form.enableTodos', 117 id: 'settings.app.form.enableTodos',
114 defaultMessage: '!!!Enable Franz Todos', 118 defaultMessage: '!!!Enable Franz Todos',
@@ -161,12 +165,14 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
161 enableSpellchecking: settingsData.enableSpellchecking, 165 enableSpellchecking: settingsData.enableSpellchecking,
162 spellcheckerLanguage: settingsData.spellcheckerLanguage, 166 spellcheckerLanguage: settingsData.spellcheckerLanguage,
163 beta: settingsData.beta, // we need this info in the main process as well 167 beta: settingsData.beta, // we need this info in the main process as well
168 noUpdates: settingsData.noUpdates, // we need this info in the main process as well
164 locale: settingsData.locale, // we need this info in the main process as well 169 locale: settingsData.locale, // we need this info in the main process as well
165 }, 170 },
166 }); 171 });
167 172
168 user.update({ 173 user.update({
169 userData: { 174 userData: {
175 noUpdates: settingsData.noUpdates,
170 beta: settingsData.beta, 176 beta: settingsData.beta,
171 locale: settingsData.locale, 177 locale: settingsData.locale,
172 }, 178 },
@@ -319,6 +325,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
319 value: user.data.beta, 325 value: user.data.beta,
320 default: DEFAULT_APP_SETTINGS.beta, 326 default: DEFAULT_APP_SETTINGS.beta,
321 }, 327 },
328 noUpdates: {
329 label: intl.formatMessage(messages.noUpdates),
330 value: settings.app.noUpdates,
331 default: DEFAULT_APP_SETTINGS.noUpdates,
332 },
322 }, 333 },
323 }; 334 };
324 335
@@ -381,6 +392,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
381 isWorkspaceEnabled={workspaces.isFeatureActive} 392 isWorkspaceEnabled={workspaces.isFeatureActive}
382 server={server || 'https://api.franzinfra.com'} 393 server={server || 'https://api.franzinfra.com'}
383 lockingFeatureEnabled={lockingFeatureEnabled} 394 lockingFeatureEnabled={lockingFeatureEnabled}
395 noUpdates={this.props.stores.settings.app.noUpdates}
384 /> 396 />
385 </ErrorBoundary> 397 </ErrorBoundary>
386 ); 398 );
diff --git a/src/electron/ipc-api/autoUpdate.js b/src/electron/ipc-api/autoUpdate.js
index 6a3314b2b..506aecdf7 100644
--- a/src/electron/ipc-api/autoUpdate.js
+++ b/src/electron/ipc-api/autoUpdate.js
@@ -4,24 +4,33 @@ import { autoUpdater } from 'electron-updater';
4const debug = require('debug')('Ferdi:ipcApi:autoUpdate'); 4const debug = require('debug')('Ferdi:ipcApi:autoUpdate');
5 5
6export default (params) => { 6export default (params) => {
7 if (process.platform === 'darwin' || process.platform === 'win32' || process.env.APPIMAGE) { 7 const disableUpdates = Boolean(params.settings.app.get('noUpdates'));
8
9 if (disableUpdates) {
10 autoUpdater.autoInstallOnAppQuit = false;
11 autoUpdater.autoDownload = false;
12 } else if (process.platform === 'darwin' || process.platform === 'win32' || process.env.APPIMAGE) {
8 ipcMain.on('autoUpdate', (event, args) => { 13 ipcMain.on('autoUpdate', (event, args) => {
9 try { 14 const enableUpdate = !params.settings.app.get('noUpdates');
10 autoUpdater.autoInstallOnAppQuit = false; 15
11 autoUpdater.allowPrerelease = Boolean(params.settings.app.get('beta')); 16 if (enableUpdate) {
12 if (args.action === 'check') { 17 try {
13 autoUpdater.checkForUpdates(); 18 autoUpdater.autoInstallOnAppQuit = false;
14 } else if (args.action === 'install') { 19 autoUpdater.allowPrerelease = Boolean(params.settings.app.get('beta'));
15 debug('install update'); 20 if (args.action === 'check') {
16 autoUpdater.quitAndInstall(); 21 autoUpdater.checkForUpdates();
17 // we need to send a quit event 22 } else if (args.action === 'install') {
18 setTimeout(() => { 23 debug('install update');
19 app.quit(); 24 autoUpdater.quitAndInstall();
20 }, 20); 25 // we need to send a quit event
26 setTimeout(() => {
27 app.quit();
28 }, 20);
29 }
30 } catch (e) {
31 console.error(e);
32 event.sender.send('autoUpdate', { error: true });
21 } 33 }
22 } catch (e) {
23 console.error(e);
24 event.sender.send('autoUpdate', { error: true });
25 } 34 }
26 }); 35 });
27 36
@@ -32,10 +41,14 @@ export default (params) => {
32 41
33 autoUpdater.on('update-available', (event) => { 42 autoUpdater.on('update-available', (event) => {
34 debug('update-available'); 43 debug('update-available');
35 params.mainWindow.webContents.send('autoUpdate', { 44
36 version: event.version, 45 const enableUpdate = !params.settings.app.get('noUpdates');
37 available: true, 46 if (enableUpdate) {
38 }); 47 params.mainWindow.webContents.send('autoUpdate', {
48 version: event.version,
49 available: true,
50 });
51 }
39 }); 52 });
40 53
41 autoUpdater.on('download-progress', (progressObj) => { 54 autoUpdater.on('download-progress', (progressObj) => {
diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json
index 4033407e3..2cb42d134 100644
--- a/src/i18n/locales/defaultMessages.json
+++ b/src/i18n/locales/defaultMessages.json
@@ -4032,29 +4032,42 @@
4032 } 4032 }
4033 }, 4033 },
4034 { 4034 {
4035 "defaultMessage": "!!!Enable Franz Todos", 4035 "defaultMessage": "!!!Disable updates",
4036 "end": { 4036 "end": {
4037 "column": 3, 4037 "column": 3,
4038 "line": 115 4038 "line": 115
4039 }, 4039 },
4040 "file": "src/containers/settings/EditSettingsScreen.js", 4040 "file": "src/containers/settings/EditSettingsScreen.js",
4041 "id": "settings.app.form.noUpdates",
4042 "start": {
4043 "column": 13,
4044 "line": 112
4045 }
4046 },
4047 {
4048 "defaultMessage": "!!!Enable Franz Todos",
4049 "end": {
4050 "column": 3,
4051 "line": 119
4052 },
4053 "file": "src/containers/settings/EditSettingsScreen.js",
4041 "id": "settings.app.form.enableTodos", 4054 "id": "settings.app.form.enableTodos",
4042 "start": { 4055 "start": {
4043 "column": 15, 4056 "column": 15,
4044 "line": 112 4057 "line": 116
4045 } 4058 }
4046 }, 4059 },
4047 { 4060 {
4048 "defaultMessage": "!!!Keep all workspaces loaded", 4061 "defaultMessage": "!!!Keep all workspaces loaded",
4049 "end": { 4062 "end": {
4050 "column": 3, 4063 "column": 3,
4051 "line": 119 4064 "line": 123
4052 }, 4065 },
4053 "file": "src/containers/settings/EditSettingsScreen.js", 4066 "file": "src/containers/settings/EditSettingsScreen.js",
4054 "id": "settings.app.form.keepAllWorkspacesLoaded", 4067 "id": "settings.app.form.keepAllWorkspacesLoaded",
4055 "start": { 4068 "start": {
4056 "column": 27, 4069 "column": 27,
4057 "line": 116 4070 "line": 120
4058 } 4071 }
4059 } 4072 }
4060 ], 4073 ],
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index ad64bec14..c8cf09366 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -231,6 +231,7 @@
231 "settings.app.form.language": "Language", 231 "settings.app.form.language": "Language",
232 "settings.app.form.lockPassword": "Ferdi Lock password", 232 "settings.app.form.lockPassword": "Ferdi Lock password",
233 "settings.app.form.minimizeToSystemTray": "Minimize Ferdi to system tray", 233 "settings.app.form.minimizeToSystemTray": "Minimize Ferdi to system tray",
234 "settings.app.form.noUpdates": "Disable updates",
234 "settings.app.form.privateNotifications": "Don't show message content in notifications", 235 "settings.app.form.privateNotifications": "Don't show message content in notifications",
235 "settings.app.form.runInBackground": "Keep Ferdi in background when closing the window", 236 "settings.app.form.runInBackground": "Keep Ferdi in background when closing the window",
236 "settings.app.form.scheduledDNDEnabled": "Enable scheduled Do-not-Disturb", 237 "settings.app.form.scheduledDNDEnabled": "Enable scheduled Do-not-Disturb",
diff --git a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
index dccf8b992..110b7787b 100644
--- a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
+++ b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
@@ -273,15 +273,28 @@
273 } 273 }
274 }, 274 },
275 { 275 {
276 "id": "settings.app.form.noUpdates",
277 "defaultMessage": "!!!Disable updates",
278 "file": "src/containers/settings/EditSettingsScreen.js",
279 "start": {
280 "line": 112,
281 "column": 13
282 },
283 "end": {
284 "line": 115,
285 "column": 3
286 }
287 },
288 {
276 "id": "settings.app.form.enableTodos", 289 "id": "settings.app.form.enableTodos",
277 "defaultMessage": "!!!Enable Franz Todos", 290 "defaultMessage": "!!!Enable Franz Todos",
278 "file": "src/containers/settings/EditSettingsScreen.js", 291 "file": "src/containers/settings/EditSettingsScreen.js",
279 "start": { 292 "start": {
280 "line": 112, 293 "line": 116,
281 "column": 15 294 "column": 15
282 }, 295 },
283 "end": { 296 "end": {
284 "line": 115, 297 "line": 119,
285 "column": 3 298 "column": 3
286 } 299 }
287 }, 300 },
@@ -290,11 +303,11 @@
290 "defaultMessage": "!!!Keep all workspaces loaded", 303 "defaultMessage": "!!!Keep all workspaces loaded",
291 "file": "src/containers/settings/EditSettingsScreen.js", 304 "file": "src/containers/settings/EditSettingsScreen.js",
292 "start": { 305 "start": {
293 "line": 116, 306 "line": 120,
294 "column": 27 307 "column": 27
295 }, 308 },
296 "end": { 309 "end": {
297 "line": 119, 310 "line": 123,
298 "column": 3 311 "column": 3
299 } 312 }
300 } 313 }