From 4c4021b3633ce725ccab3bb23d1a6a7878b16514 Mon Sep 17 00:00:00 2001 From: Saurav Kothari Date: Mon, 23 Sep 2019 22:29:27 +0530 Subject: Add tooltip with shortcuts for Workspaces --- src/features/workspaces/components/WorkspaceDrawer.js | 4 +++- src/features/workspaces/components/WorkspaceDrawerItem.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/features/workspaces/components/WorkspaceDrawer.js b/src/features/workspaces/components/WorkspaceDrawer.js index e7bc0b157..ee6f8416c 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.js +++ b/src/features/workspaces/components/WorkspaceDrawer.js @@ -204,8 +204,9 @@ class WorkspaceDrawer extends Component { }} services={getServicesForWorkspace(null)} isActive={actualWorkspace == null} + shortcutIndex={0} /> - {workspaces.map(workspace => ( + {workspaces.map((workspace, index) => ( workspaceActions.edit({ workspace })} services={getServicesForWorkspace(workspace)} + shortcutIndex={index + 1} /> ))}
( onContextMenuEditClick && contextMenu.popup(remote.getCurrentWindow()) )} + data-tip={`${shortcutIndex <= 9 ? `(${ctrlKey}+Alt+${shortcutIndex})` : ''}`} > Date: Mon, 23 Sep 2019 22:50:14 +0530 Subject: ESLINT fix : Missing comma --- src/features/workspaces/components/WorkspaceDrawerItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.js b/src/features/workspaces/components/WorkspaceDrawerItem.js index 9292aa87e..18f424d8a 100644 --- a/src/features/workspaces/components/WorkspaceDrawerItem.js +++ b/src/features/workspaces/components/WorkspaceDrawerItem.js @@ -89,7 +89,7 @@ class WorkspaceDrawerItem extends Component { onClick, onContextMenuEditClick, services, - shortcutIndex + shortcutIndex, } = this.props; const { intl } = this.context; -- cgit v1.2.3-70-g09d2 From bd9fa0d0fb153db0ebccfaa39b8e06728ddc147b Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 2 Oct 2019 17:26:34 +0200 Subject: Clear confetti timeout on component unmount --- src/components/services/content/Services.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/components/services/content/Services.js b/src/components/services/content/Services.js index 73c27bfb6..b6291666b 100644 --- a/src/components/services/content/Services.js +++ b/src/components/services/content/Services.js @@ -56,16 +56,24 @@ export default @observer @injectSheet(styles) class Services extends Component { state = { showConfetti: true, - } + }; + + _confettiTimeout = null; componentDidMount() { - window.setTimeout(() => { + this._confettiTimeout = window.setTimeout(() => { this.setState({ showConfetti: false, }); }, ms('8s')); } + componentWillUnmount() { + if (this._confettiTimeout) { + clearTimeout(this._confettiTimeout); + } + } + render() { const { services, -- cgit v1.2.3-70-g09d2 From 17564073c2cfe29864d0763913eeaf4e0d0cf874 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 2 Oct 2019 17:43:09 +0200 Subject: Add workaround for electron webview issue with disappearing cursors --- src/components/services/content/ServiceWebview.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 07bd17d9c..b3198d36a 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js @@ -20,6 +20,13 @@ class ServiceWebview extends Component { detachService({ service }); } + refocusWebview = () => { + const { webview } = this; + if (!webview) return; + webview.view.blur(); + webview.view.focus(); + }; + render() { const { service, @@ -28,7 +35,10 @@ class ServiceWebview extends Component { return ( { this.webview = webview; }} + ref={(webview) => { + this.webview = webview; + webview.view.addEventListener('did-stop-loading', this.refocusWebview); + }} autosize src={service.url} preload="./webview/recipe.js" -- cgit v1.2.3-70-g09d2 From e2126a60ad287e76a24c44242b80699e49e8fb0e Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 2 Oct 2019 21:38:26 +0200 Subject: fix(Service Proxies): Fix proxy setting rehydration --- src/index.js | 17 +---------------- src/models/Service.js | 41 ++++++++++++++++++++++++++++++++++------- src/stores/ServicesStore.js | 1 + 3 files changed, 36 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/index.js b/src/index.js index d9d51fd5b..7de7a5e1c 100644 --- a/src/index.js +++ b/src/index.js @@ -331,22 +331,7 @@ app.on('login', (event, webContents, request, authInfo, callback) => { debug('browser login event', authInfo); event.preventDefault(); - if (authInfo.isProxy && authInfo.scheme === 'basic') { - debug('Sending service echo ping'); - webContents.send('get-service-id'); - - ipcMain.once('service-id', (e, id) => { - debug('Received service id', id); - - const ps = proxySettings.get(id); - if (ps) { - debug('Sending proxy auth callback for service', id); - callback(ps.user, ps.password); - } else { - debug('No proxy auth config found for', id); - } - }); - } else if (authInfo.scheme === 'basic') { + if (!authInfo.isProxy && authInfo.scheme === 'basic') { debug('basic auth handler', authInfo); basicAuthHandler(mainWindow, authInfo); } diff --git a/src/models/Service.js b/src/models/Service.js index 023103048..e45c39564 100644 --- a/src/models/Service.js +++ b/src/models/Service.js @@ -188,19 +188,24 @@ export default class Service { return userAgent; } - initializeWebViewEvents({ handleIPCMessage, openWindow }) { + initializeWebViewEvents({ handleIPCMessage, openWindow, stores }) { + const webContents = this.webview.getWebContents(); + this.webview.addEventListener('ipc-message', e => handleIPCMessage({ serviceId: this.id, channel: e.channel, args: e.args, })); - this.webview.addEventListener('new-window', (event, url, frameName, options) => openWindow({ - event, - url, - frameName, - options, - })); + this.webview.addEventListener('new-window', (event, url, frameName, options) => { + console.log('open window', event, url, frameName, options); + openWindow({ + event, + url, + frameName, + options, + }); + }); this.webview.addEventListener('did-start-loading', (event) => { debug('Did start load', this.name, event); @@ -234,6 +239,28 @@ export default class Service { debug('Service crashed', this.name); this.hasCrashed = true; }); + + webContents.on('login', (event, request, authInfo, callback) => { + // const authCallback = callback; + debug('browser login event', authInfo); + event.preventDefault(); + + if (authInfo.isProxy && authInfo.scheme === 'basic') { + debug('Sending service echo ping'); + webContents.send('get-service-id'); + + debug('Received service id', this.id); + + const ps = stores.settings.proxy[this.id]; + + if (ps) { + debug('Sending proxy auth callback for service', this.id); + callback(ps.user, ps.password); + } else { + debug('No proxy auth config found for', this.id); + } + } + }); } initializeWebViewListener() { diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index d1fd2be3d..08befe4eb 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js @@ -345,6 +345,7 @@ export default class ServicesStore extends Store { service.initializeWebViewEvents({ handleIPCMessage: this.actions.service.handleIPCMessage, openWindow: this.actions.service.openWindow, + stores: this.stores, }); service.initializeWebViewListener(); } -- cgit v1.2.3-70-g09d2 From a564a35bcf9bcfedd6dc7bc60ce2c115badd6985 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 2 Oct 2019 21:39:03 +0200 Subject: Use native window.open --- src/webview/recipe.js | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index c223b73de..7be307f05 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -169,15 +169,3 @@ class RecipeController { /* eslint-disable no-new */ new RecipeController(); /* eslint-enable no-new */ - -// Patching window.open -const originalWindowOpen = window.open; - -window.open = (url, frameName, features) => { - // We need to differentiate if the link should be opened in a popup or in the systems default browser - if (!frameName && !features) { - return ipcRenderer.sendToHost('new-window', url); - } - - return originalWindowOpen(url, frameName, features); -}; -- cgit v1.2.3-70-g09d2 From 027e50d822737329cb95c2b1e3dbd487cf18332a Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Wed, 2 Oct 2019 21:51:35 +0200 Subject: fix(Basic Auth): Fix Basic Auth overlay background in Dark Mode --- packages/theme/src/themes/dark/index.ts | 1 + packages/theme/src/themes/default/index.ts | 1 + src/components/ui/Modal/styles.js | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/packages/theme/src/themes/dark/index.ts b/packages/theme/src/themes/dark/index.ts index e94f54c55..67d0cfb71 100644 --- a/packages/theme/src/themes/dark/index.ts +++ b/packages/theme/src/themes/dark/index.ts @@ -66,6 +66,7 @@ export const selectSearchColor = inputBackground; // Modal export const colorModalOverlayBackground = color(legacyStyles.darkThemeBlack).alpha(0.8).rgb().string(); +export const colorModalBackground = colorContentBackground; // Services export const services = merge({}, defaultStyles.services, { diff --git a/packages/theme/src/themes/default/index.ts b/packages/theme/src/themes/default/index.ts index 4e042afce..057fde72f 100644 --- a/packages/theme/src/themes/default/index.ts +++ b/packages/theme/src/themes/default/index.ts @@ -145,6 +145,7 @@ export const badgeBorderRadius = 50; // Modal export const colorModalOverlayBackground = color('#000').alpha(0.5).rgb().string(); +export const colorModalBackground = colorContentBackground; // Services export const services = { diff --git a/src/components/ui/Modal/styles.js b/src/components/ui/Modal/styles.js index 49b970c97..c2bebf9bb 100644 --- a/src/components/ui/Modal/styles.js +++ b/src/components/ui/Modal/styles.js @@ -13,7 +13,7 @@ export default theme => ({ display: 'flex', }, modal: { - background: '#FFF', + background: theme.colorModalBackground, maxWidth: '90%', height: 'auto', margin: 'auto auto', -- cgit v1.2.3-70-g09d2 From d390f216c3e0ecd38067d19da8bd882e6a0303a7 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 3 Oct 2019 13:51:00 +0200 Subject: re-fix & improve new-window handling --- src/webview/recipe.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 7be307f05..e1ff44f05 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -12,6 +12,7 @@ import contextMenu from './contextMenu'; import './notifications'; import { DEFAULT_APP_SETTINGS } from '../config'; +import { isDevMode } from '../environment'; const debug = require('debug')('Franz:Plugin'); @@ -169,3 +170,17 @@ class RecipeController { /* eslint-disable no-new */ new RecipeController(); /* eslint-enable no-new */ + +// Patching window.open +const originalWindowOpen = window.open; + + +window.open = (url, frameName, features) => { + debug('window.open', url, frameName, features); + // We need to differentiate if the link should be opened in a popup or in the systems default browser + if (!frameName && !features && typeof features !== 'string') { + return ipcRenderer.sendToHost('new-window', url); + } + + return originalWindowOpen(url, frameName, features); +}; -- cgit v1.2.3-70-g09d2 From faecce7f35b566e50224804108621ae6db4739ab Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 3 Oct 2019 13:51:16 +0200 Subject: Add `window.log` for easier logging in event mode --- src/webview/recipe.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index e1ff44f05..353eb31fd 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -184,3 +184,7 @@ window.open = (url, frameName, features) => { return originalWindowOpen(url, frameName, features); }; + +if (isDevMode) { + window.log = console.log; +} -- cgit v1.2.3-70-g09d2