aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar kytwb <kytwb@pm.me>2022-01-05 19:13:39 +0100
committerLibravatar kytwb <kytwb@pm.me>2022-01-05 19:13:39 +0100
commit87ae988d5d2dff445ddb7db0e3d675b29a870a4d (patch)
treeefa62d567fcb2a1026a3f86e4a56b30db3ae82c4 /src
parentRevert "#512 Show updates tab for Mac, Windows and AppImage only" (diff)
downloadferdium-app-87ae988d5d2dff445ddb7db0e3d675b29a870a4d.tar.gz
ferdium-app-87ae988d5d2dff445ddb7db0e3d675b29a870a4d.tar.zst
ferdium-app-87ae988d5d2dff445ddb7db0e3d675b29a870a4d.zip
#512 Restrict in-app update to Mac, Windows and AppImage
Diffstat (limited to 'src')
-rw-r--r--src/components/settings/settings/EditSettingsForm.js78
-rw-r--r--src/stores/AppStore.js11
2 files changed, 47 insertions, 42 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index c113bd9eb..24ba644f4 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -768,46 +768,50 @@ class EditSettingsForm extends Component {
768 {this.state.activeSetttingsTab === 'updates' && ( 768 {this.state.activeSetttingsTab === 'updates' && (
769 <div> 769 <div>
770 <Toggle field={form.$('automaticUpdates')} /> 770 <Toggle field={form.$('automaticUpdates')} />
771 {automaticUpdates && ( 771 {(isMac || isWindows || process.env.APPIMAGE) && (
772 <div>
773 <Toggle field={form.$('beta')} />
774 {updateIsReadyToInstall ? (
775 <Button
776 label={intl.formatMessage(messages.buttonInstallUpdate)}
777 onClick={installUpdate}
778 />
779 ) : (
780 <Button
781 buttonType="secondary"
782 label={intl.formatMessage(updateButtonLabelMessage)}
783 onClick={checkForUpdates}
784 disabled={
785 !automaticUpdates ||
786 isCheckingForUpdates ||
787 isUpdateAvailable ||
788 !isOnline
789 }
790 loaded={!isCheckingForUpdates || !isUpdateAvailable}
791 />
792 )}
793 <br />
794 </div>
795 )}
796 <p>
797 {intl.formatMessage(messages.currentVersion)} {ferdiVersion}
798 </p>
799 {noUpdateAvailable && (
800 <> 772 <>
801 <br /> 773 {automaticUpdates && (
802 <br /> 774 <>
803 {intl.formatMessage(messages.updateStatusUpToDate)}. 775 <div>
776 <Toggle field={form.$('beta')} />
777 {updateIsReadyToInstall ? (
778 <Button
779 label={intl.formatMessage(messages.buttonInstallUpdate)}
780 onClick={installUpdate}
781 />
782 ) : (
783 <Button
784 buttonType="secondary"
785 label={intl.formatMessage(updateButtonLabelMessage)}
786 onClick={checkForUpdates}
787 disabled={
788 !automaticUpdates ||
789 isCheckingForUpdates ||
790 isUpdateAvailable ||
791 !isOnline
792 }
793 loaded={!isCheckingForUpdates || !isUpdateAvailable}
794 />
795 )}
796 <br />
797 </div>
798 <p>
799 {intl.formatMessage(messages.currentVersion)} {ferdiVersion}
800 </p>
801 {noUpdateAvailable && (
802 <p>
803 {intl.formatMessage(messages.updateStatusUpToDate)}.
804 </p>
805 )}
806 {updateFailed && (
807 <Infobox type="danger" icon="alert">
808 An error occured (check the console for more details)
809 </Infobox>
810 )}
811 </>
812 )}
804 </> 813 </>
805 )} 814 )}
806 {updateFailed && (
807 <Infobox type="danger" icon="alert">
808 An error occured (check the console for more details)
809 </Infobox>
810 )}
811 <p className="settings__message"> 815 <p className="settings__message">
812 <Icon icon={mdiGithub} /> 816 <Icon icon={mdiGithub} />
813 Ferdi is based on{' '} 817 Ferdi is based on{' '}
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index fd7c58dfc..54a3e4d92 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -17,7 +17,7 @@ import { readJsonSync } from 'fs-extra';
17import Store from './lib/Store'; 17import Store from './lib/Store';
18import Request from './lib/Request'; 18import Request from './lib/Request';
19import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config'; 19import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config';
20import { isMac, electronVersion, osRelease } from '../environment'; 20import { isMac, isWindows, electronVersion, osRelease } from '../environment';
21import { ferdiVersion, userDataPath, ferdiLocale } from '../environment-remote'; 21import { ferdiVersion, userDataPath, ferdiLocale } from '../environment-remote';
22import { generatedTranslations } from '../i18n/translations'; 22import { generatedTranslations } from '../i18n/translations';
23import { getLocale } from '../helpers/i18n-helpers'; 23import { getLocale } from '../helpers/i18n-helpers';
@@ -382,15 +382,16 @@ export default class AppStore extends Store {
382 } 382 }
383 383
384 @action _checkForUpdates() { 384 @action _checkForUpdates() {
385 if (this.isOnline) { 385 if (this.isOnline && this.stores.settings.app.automaticUpdates && (isMac || isWindows || process.env.APPIMAGE)) {
386 debug('_checkForUpdates: sending event to autoUpdate:check'); 386 debug('_checkForUpdates: sending event to autoUpdate:check');
387 this.updateStatus = this.updateStatusTypes.CHECKING; 387 this.updateStatus = this.updateStatusTypes.CHECKING;
388 ipcRenderer.send('autoUpdate', { 388 ipcRenderer.send('autoUpdate', {
389 action: 'check', 389 action: 'check',
390 }); 390 });
391 if (this.stores.settings.app.automaticUpdates) { 391 }
392 this.actions.recipe.update(); 392
393 } 393 if (this.isOnline && this.stores.settings.app.automaticUpdates) {
394 this.actions.recipe.update();
394 } 395 }
395 } 396 }
396 397