From c717ccd5ef589444d4c0db3d6399d163cd73df01 Mon Sep 17 00:00:00 2001 From: Jochen Date: Thu, 11 Jun 2020 12:27:00 +0200 Subject: [PATCH] Optimize progress messages, fix login window error Issue #5 Signed-off-by: Jochen --- index.js | 1 + login.js | 5 ++--- share.js | 2 +- upload.js | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 88d583a..2ea3cae 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,7 @@ const action = async context => { await login(context) } catch (error) { if (error.message === 'canceled') { + context.setProgress('Authorization completed', 'completed') context.cancel() } else { console.error(error.message) diff --git a/login.js b/login.js index 54b9749..2f92580 100644 --- a/login.js +++ b/login.js @@ -1,7 +1,6 @@ const electron = require('electron') const join = require('url-join') const { protocol } = require('electron') - const BrowserWindow = electron.BrowserWindow || electron.remote.BrowserWindow const login = context => { @@ -26,12 +25,12 @@ const login = context => { context.config.set('password', credentials.password) /** - * Resolve prmise and destroy BrowserWindow + * Resolve promise and destroy BrowserWindow */ resolve() authWindow.destroy() }, function (error) { - console.error(error.message) + console.error(error) }) const authWindow = new BrowserWindow({ diff --git a/share.js b/share.js index 4bc96e7..2679cdc 100644 --- a/share.js +++ b/share.js @@ -57,7 +57,7 @@ const share = (context, filePath) => { } else { context.copyToClipboard(body.ocs.data.url + additionalInfo) context.notify('Nextcloud uploaded, link copied to Clipboard') - context.setProgress('Done', 'completed') + context.setProgress('Upload done and share link created…', 'completed') } } catch (error) { context.notify('Could not get share link: ' + error.message) diff --git a/upload.js b/upload.js index ff46422..84113eb 100644 --- a/upload.js +++ b/upload.js @@ -33,7 +33,6 @@ const upload = (context, filePath) => { context.setProgress('Upload finished', 'completed') share(context, filePath) }) - context.setProgress('Upload finished', 'completed') } module.exports = upload