diff --git a/.eslintignore b/.eslintignore index a329768a7..167257849 100644 --- a/.eslintignore +++ b/.eslintignore @@ -174,6 +174,7 @@ ReactNativeClient/lib/services/synchronizer/utils/types.js ReactNativeClient/lib/services/UndoRedoService.js ReactNativeClient/lib/ShareExtension.js ReactNativeClient/lib/shareHandler.js +ReactNativeClient/lib/versionInfo.js ReactNativeClient/PluginAssetsLoader.js ReactNativeClient/setUpQuickActions.js # AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD diff --git a/.gitignore b/.gitignore index 486857527..a6b60c065 100644 --- a/.gitignore +++ b/.gitignore @@ -165,6 +165,7 @@ ReactNativeClient/lib/services/synchronizer/utils/types.js ReactNativeClient/lib/services/UndoRedoService.js ReactNativeClient/lib/ShareExtension.js ReactNativeClient/lib/shareHandler.js +ReactNativeClient/lib/versionInfo.js ReactNativeClient/PluginAssetsLoader.js ReactNativeClient/setUpQuickActions.js # AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD diff --git a/ElectronClient/app.js b/ElectronClient/app.js index 6bd6bc987..2acdb30e9 100644 --- a/ElectronClient/app.js +++ b/ElectronClient/app.js @@ -34,6 +34,7 @@ const KeymapService = require('lib/services/KeymapService.js').default; const TemplateUtils = require('lib/TemplateUtils'); const CssUtils = require('lib/CssUtils'); const resourceEditWatcherReducer = require('lib/services/ResourceEditWatcher/reducer').default; +const versionInfo = require('lib/versionInfo').default; const commands = [ require('./gui/Header/commands/focusSearch'), @@ -598,37 +599,17 @@ class Application extends BaseApplication { } function _showAbout() { - const p = packageInfo; - let gitInfo = ''; - if ('git' in p) { - gitInfo = _('Revision: %s (%s)', p.git.hash, p.git.branch); - } - const copyrightText = 'Copyright © 2016-YYYY Laurent Cozic'; - const message = [ - p.description, - '', - copyrightText.replace('YYYY', new Date().getFullYear()), - _('%s %s (%s, %s)', p.name, p.version, Setting.value('env'), process.platform), - '', - _('Client ID: %s', Setting.value('clientId')), - _('Sync Version: %s', Setting.value('syncVersion')), - _('Profile Version: %s', reg.db().version()), - _('Keychain Supported: %s', Setting.value('keychain.supported') >= 1 ? _('Yes') : _('No')), - ]; - if (gitInfo) { - message.push(`\n${gitInfo}`); - console.info(gitInfo); - } - const text = message.join('\n'); + const v = versionInfo(packageInfo); - const copyToClipboard = bridge().showMessageBox(text, { + const copyToClipboard = bridge().showMessageBox(v.message, { icon: `${bridge().electronApp().buildDir()}/icons/128x128.png`, buttons: [_('Copy'), _('OK')], cancelId: 1, defaultId: 1, }); + if (copyToClipboard === 0) { - clipboard.writeText(message.splice(3).join('\n')); + clipboard.writeText(v.message); } } @@ -1096,7 +1077,7 @@ class Application extends BaseApplication { return { action: 'upgradeSyncTarget' }; } - const dir = Setting.value('profileDir'); + const dir = Setting.value('profileDir'); // Loads app-wide styles. (Markdown preview-specific styles loaded in app.js) const filename = Setting.custom_css_files.JOPLIN_APP; diff --git a/ElectronClient/gui/ErrorBoundary.tsx b/ElectronClient/gui/ErrorBoundary.tsx index 25feb636e..e2fe6a6db 100644 --- a/ElectronClient/gui/ErrorBoundary.tsx +++ b/ElectronClient/gui/ErrorBoundary.tsx @@ -1,4 +1,7 @@ import * as React from 'react'; +import versionInfo from 'lib/versionInfo'; +const packageInfo = require('../packageInfo.js'); +const ipcRenderer = require('electron').ipcRenderer; export default class ErrorBoundary extends React.Component { @@ -8,22 +11,52 @@ export default class ErrorBoundary extends React.Component { this.setState({ error: error, errorInfo: errorInfo }); } + componentDidMount() { + const onAppClose = () => { + ipcRenderer.send('asynchronous-message', 'appCloseReply', { + canClose: true, + }); + }; + + ipcRenderer.on('appClose', onAppClose); + } + render() { if (this.state.error) { try { const output = []; - output.push(
{this.state.error.message}
); + + output.push( +{this.state.error.message}
+{versionInfo(packageInfo).message}+
{this.state.error.stack}); + output.push( +
{this.state.error.stack}+
{this.state.errorInfo.componentStack}); + output.push( +
{this.state.errorInfo.componentStack}+