Skip to content

Commit

Permalink
Merge branch 'release/5.9.2' of https://github.com/meetfranz/franz in…
Browse files Browse the repository at this point in the history
…to release/5.9.2
  • Loading branch information
adlk committed Apr 6, 2022
2 parents 6d0bfa2 + b0dac2d commit c22f871
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 23 deletions.
29 changes: 26 additions & 3 deletions src/electron/ipc-api/browserViewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { loadRecipeConfig } from '../../helpers/recipe-helpers';
import {
GET_ACTIVE_SERVICE_WEB_CONTENTS_ID,
HIDE_ALL_SERVICES,
NAVIGATE_SERVICE_TO, OPEN_SERVICE_DEV_TOOLS, RELOAD_SERVICE, RESIZE_SERVICE_VIEWS, RESIZE_TODO_VIEW, SHOW_ALL_SERVICES, TODOS_FETCH_WEB_CONTENTS_ID, USER_LOGIN_STATUS,
NAVIGATE_SERVICE_TO, OPEN_SERVICE_DEV_TOOLS, RELOAD_SERVICE, RESIZE_SERVICE_VIEWS, RESIZE_TODO_VIEW, SHOW_ALL_SERVICES, TODOS_FETCH_WEB_CONTENTS_ID, TODOS_OPEN_DEV_TOOLS, TODOS_RELOAD, USER_LOGIN_STATUS,
} from '../../ipcChannels';
import { TODOS_RECIPE_ID } from '../../config';

Expand Down Expand Up @@ -187,15 +187,38 @@ export default async ({ mainWindow, settings: { app: settings } }: { mainWindow:
}
});

ipcMain.on(RELOAD_SERVICE, (e, { serviceId }) => {
const sbw = browserViews.find(browserView => browserView.id === serviceId);
ipcMain.on(TODOS_OPEN_DEV_TOOLS, () => {
const contents = browserViews.find(browserView => browserView.browserView.isTodos)?.browserView.webContents;

if (contents) {
if(contents.isDevToolsOpened()) {
contents.closeDevTools();
} else {
contents.openDevTools({ mode: 'detach' });
}
}
});

ipcMain.on(RELOAD_SERVICE, (e, { serviceId } = { serviceId: null }) => {
let sbw: IBrowserViewCache;
if (serviceId) {
sbw = browserViews.find(browserView => browserView.id === serviceId);
} else {
sbw = browserViews.find(browserView => browserView.browserView.isActive);
}

if (sbw) {
debug(`Reload service '${sbw.browserView.config.name}'`);
sbw.browserView.webContents.reload();
}
});

ipcMain.on(TODOS_RELOAD, (e) => {
let sbw: IBrowserViewCache;

browserViews.find(browserView => browserView.browserView.isTodos)?.browserView.webContents.reload();
});

ipcMain.on(NAVIGATE_SERVICE_TO, (e, { serviceId, url }) => {
const sbw = browserViews.find(browserView => browserView.id === serviceId);

Expand Down
5 changes: 1 addition & 4 deletions src/features/todos/components/TodosWebview.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ const styles = theme => ({
root: {
background: theme.colorBackground,
position: 'relative',
zIndex: 300,
borderLeft: ({ isVisible }) => (isVisible ? [1, 'solid', theme.todos.todosLayer.borderLeftColor] : 0),

transform: ({ isVisible, width, isTodosServiceActive }) => `translateX(${isVisible || isTodosServiceActive ? 0 : width}px)`,
borderLeft: ({ isVisible }) => (isVisible ? [`1px solid ${theme.todos.todosLayer.borderLeftColor}`] : 0),
},
resizeHandler: {
position: 'absolute',
Expand Down
3 changes: 3 additions & 0 deletions src/ipcChannels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const PLAN_SELECTION_TRIGGER_ACTION = 'PLAN_SELECTION_TRIGGER_ACTION';
export const TODOS_FETCH_WEB_CONTENTS_ID = 'TODOS_FETCH_WEB_CONTENTS_ID';
export const TODOS_TOGGLE_DRAWER = 'TODOS_TOGGLE_DRAWER';
export const TODOS_TOGGLE_ENABLE_TODOS = 'TODOS_TOGGLE_ENABLE_TODOS';
export const TODOS_RELOAD = 'TODOS_RELOAD';
export const TODOS_OPEN_DEV_TOOLS = 'TODOS_OPEN_DEV_TOOLS';

// Windows Titlebar
export const WINDOWS_TITLEBAR_INITIALIZE = 'WINDOWS_TITLEBAR_INITIALIZE';
Expand All @@ -53,3 +55,4 @@ export const CHECK_FOR_UPDATE = 'CHECK_FOR_UPDATE';
export const FETCH_DEBUG_INFO = 'FETCH_DEBUG_INFO';
export const TOGGLE_FULL_SCREEN = 'TOGGLE_FULL_SCREEN';
export const CHECK_MACOS_PERMISSIONS = 'CHECK_MACOS_PERMISSIONS';
export const RELOAD_APP = 'RELOAD_APP';
22 changes: 8 additions & 14 deletions src/lib/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { GA_CATEGORY_TODOS, todosStore } from '../features/todos';
import { todoActions } from '../features/todos/actions';
import { CUSTOM_WEBSITE_ID } from '../features/webControls/constants';
import {
ACTIVATE_NEXT_SERVICE, ACTIVATE_PREVIOUS_SERVICE, ACTIVATE_SERVICE, CHECK_FOR_UPDATE, FETCH_DEBUG_INFO, GET_ACTIVE_SERVICE_WEB_CONTENTS_ID, SETTINGS_NAVIGATE_TO, TODOS_TOGGLE_DRAWER, TODOS_TOGGLE_ENABLE_TODOS, TOGGLE_FULL_SCREEN, WINDOWS_TITLEBAR_FETCH_MENU, WORKSPACE_ACTIVATE, WORKSPACE_OPEN_SETTINGS, WORKSPACE_TOGGLE_DRAWER,
ACTIVATE_NEXT_SERVICE, ACTIVATE_PREVIOUS_SERVICE, ACTIVATE_SERVICE, CHECK_FOR_UPDATE, FETCH_DEBUG_INFO, GET_ACTIVE_SERVICE_WEB_CONTENTS_ID, OPEN_SERVICE_DEV_TOOLS, RELOAD_APP, RELOAD_SERVICE, SETTINGS_NAVIGATE_TO, TODOS_OPEN_DEV_TOOLS, TODOS_RELOAD, TODOS_TOGGLE_DRAWER, TODOS_TOGGLE_ENABLE_TODOS, TOGGLE_FULL_SCREEN, WINDOWS_TITLEBAR_FETCH_MENU, WORKSPACE_ACTIVATE, WORKSPACE_OPEN_SETTINGS, WORKSPACE_TOGGLE_DRAWER,
} from '../ipcChannels';
import { DEFAULT_WEB_CONTENTS_ID } from '../config';

Expand Down Expand Up @@ -844,29 +844,23 @@ function viewMenu({
click: () => {
if (user.isLoggedIn
&& services.length > 0) {
// if (this.stores.services.active.recipe.id === CUSTOM_WEBSITE_ID) {
// this.actions.service.reloadActive({
// ignoreNavigation: true,
// });
// } else {
this.actions.service.reloadActive();
// }
ipcRenderer.send(RELOAD_SERVICE);
} else {
window.location.reload();
ipcRenderer.sendTo(DEFAULT_WEB_CONTENTS_ID, RELOAD_APP);
}
},
}, {
label: intl.formatMessage(menuItems.reloadFranz),
accelerator: `${cmdKey}+Shift+R`,
click: () => {
window.location.reload();
ipcRenderer.sendTo(DEFAULT_WEB_CONTENTS_ID, RELOAD_APP);
},
}, {
label: intl.formatMessage(menuItems.reloadTodos),
accelerator: `${cmdKey}+Shift+Alt+R`,
enabled: user.isLoggedIn,
click: () => {
this.actions.todos.reload();
ipcRenderer.send(TODOS_RELOAD);
},
},
{
Expand Down Expand Up @@ -918,7 +912,7 @@ function viewMenu({
label: intl.formatMessage(menuItems.toggleDevTools),
accelerator: `${cmdKey}+Alt+I`,
click: () => {
const windowWebContents = webContents.fromId(1);
const windowWebContents = webContents.fromId(DEFAULT_WEB_CONTENTS_ID);
const { isDevToolsOpened, openDevTools, closeDevTools } = windowWebContents;

if (isDevToolsOpened()) {
Expand All @@ -931,7 +925,7 @@ function viewMenu({
label: intl.formatMessage(menuItems.toggleServiceDevTools),
accelerator: `${cmdKey}+Shift+Alt+I`,
click: () => {
this.actions.service.openDevToolsForActiveService();
ipcRenderer.send(OPEN_SERVICE_DEV_TOOLS);
},
enabled: user.isLoggedIn && services.length > 0,
},
Expand All @@ -943,7 +937,7 @@ function viewMenu({
accelerator: `${cmdKey}+Shift+Alt+O`,
enabled: user.isLoggedIn,
click: () => {
this.actions.todos.toggleDevTools();
ipcRenderer.send(TODOS_OPEN_DEV_TOOLS);
},
});
}
Expand Down
7 changes: 5 additions & 2 deletions src/stores/AppStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { isValidExternalURL } from '../helpers/url-helpers';
import { sleep } from '../helpers/async-helpers';
import { UPDATE_FULL_SCREEN_STATUS } from '../electron/ipc-api/fullscreen';
import {
CHECK_FOR_UPDATE, CHECK_MACOS_PERMISSIONS, FETCH_DEBUG_INFO, OVERLAY_SHARE_SETTINGS, WINDOWS_TITLEBAR_FETCH_MENU, WINDOWS_TITLEBAR_INITIALIZE,
CHECK_FOR_UPDATE, CHECK_MACOS_PERMISSIONS, FETCH_DEBUG_INFO, OVERLAY_SHARE_SETTINGS, RELOAD_APP, WINDOWS_TITLEBAR_FETCH_MENU, WINDOWS_TITLEBAR_INITIALIZE,
} from '../ipcChannels';

const debug = require('debug')('Franz:AppStore');
Expand Down Expand Up @@ -173,9 +173,12 @@ export default class AppStore extends Store {
ipcRenderer.on(UPDATE_FULL_SCREEN_STATUS, (e, status) => {
this.isFullScreen = status;
});
ipcRenderer.on(RELOAD_APP, (e, status) => {
window.location.reload();
});
ipcRenderer.on(FETCH_DEBUG_INFO, (e) => {
console.log('huhu debug');
ipcRenderer.sendTo(e.senderId, FETCH_DEBUG_INFO, JSON.parse(JSON.stringify(this.debugInfo)));
});
Expand Down

0 comments on commit c22f871

Please sign in to comment.