1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Fixes #3645: Improved handling of startup errors, and prevent window from being invisible when upgrading sync target

This commit is contained in:
Laurent Cozic 2020-09-01 22:25:23 +01:00
parent c01219e6be
commit bdfb6b97f5
7 changed files with 17 additions and 7 deletions

View File

@ -62,7 +62,6 @@ Modules/TinyMCE/langs/
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
CliClient/app/LinkSelector.js
CliClient/build/LinkSelector.js
CliClient/tests/synchronizer_LockHandler.js
CliClient/tests/synchronizer_MigrationHandler.js
ElectronClient/commands/focusElement.js

1
.gitignore vendored
View File

@ -53,7 +53,6 @@ Tools/commit_hook.txt
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
CliClient/app/LinkSelector.js
CliClient/build/LinkSelector.js
CliClient/tests/synchronizer_LockHandler.js
CliClient/tests/synchronizer_MigrationHandler.js
ElectronClient/commands/focusElement.js

View File

@ -8,9 +8,10 @@ const { ipcMain } = require('electron');
class ElectronAppWrapper {
constructor(electronApp, env, profilePath) {
constructor(electronApp, env, profilePath, isDebugMode) {
this.electronApp_ = electronApp;
this.env_ = env;
this.isDebugMode_ = isDebugMode;
this.profilePath_ = profilePath;
this.win_ = null;
this.willQuitApp_ = false;
@ -41,7 +42,7 @@ class ElectronAppWrapper {
createWindow() {
// Set to true to view errors if the application does not start
const debugEarlyBugs = this.env_ === 'dev';
const debugEarlyBugs = this.env_ === 'dev' || this.isDebugMode_;
const windowStateKeeper = require('electron-window-state');

View File

@ -1075,9 +1075,13 @@ class Application extends BaseApplication {
argv = await super.start(argv);
if (Setting.value('sync.upgradeState') === Setting.SYNC_UPGRADE_STATE_MUST_DO) {
reg.logger().info('app.start: doing upgradeSyncTarget action');
bridge().window().show();
return { action: 'upgradeSyncTarget' };
}
reg.logger().info('app.start: doing regular boot');
const dir = Setting.value('profileDir');
// Loads app-wide styles. (Markdown preview-specific styles loaded in app.js)

View File

@ -29,8 +29,9 @@ Logger.fsDriver_ = new FsDriverNode();
const env = envFromArgs(process.argv);
const profilePath = profileFromArgs(process.argv);
const isDebugMode = !!process.argv && process.argv.indexOf('--debug') >= 0;
const wrapper = new ElectronAppWrapper(electronApp, env, profilePath);
const wrapper = new ElectronAppWrapper(electronApp, env, profilePath, isDebugMode);
initBridge(wrapper);

View File

@ -167,6 +167,12 @@ class BaseApplication {
continue;
}
if (arg == '--debug') {
// Currently only handled by ElectronAppWrapper (isDebugMode property)
argv.splice(0, 1);
continue;
}
if (arg == '--update-geolocation-disabled') {
Note.updateGeolocationEnabled_ = false;
argv.splice(0, 1);

View File

@ -4,14 +4,14 @@ It is possible to get the apps to display or log more information that might hel
## Desktop application
- Add a file named "flags.txt" in the config directory (should be `~/.config/joplin-desktop` or `c:\Users\YOUR_NAME\.config\joplin-desktop`) with the following content: `--open-dev-tools --log-level debug`
- Add a file named "flags.txt" in the config directory (should be `~/.config/joplin-desktop` or `c:\Users\YOUR_NAME\.config\joplin-desktop`) with the following content: `--open-dev-tools --debug --log-level debug`
- Restart the application
- The development tools should now be opened. Click the "Console" tab
- Now repeat the action that was causing problem. The console might output warnings or errors - please add them to the GitHub issue. Also open log.txt in the config folder and if there is any error or warning, please also add them to the issue.
## CLI application
- Start the app with `joplin --log-level debug`
- Start the app with `joplin --debug --log-level debug`
- Check the log.txt as specified above for the desktop application and attach the log to the GitHub issue (or just the warnings/errors if any)
## Mobile application