Skip to content

Commit

Permalink
wip: migrate to new ipc pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
adlk committed Dec 6, 2024
1 parent 4a483f4 commit 1ba0d5a
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 150 deletions.
78 changes: 33 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"cross-env": "^5.0.5",
"cz-conventional-changelog": "2.1.0",
"dotenv": "^4.0.0",
"electron": "29.0.0",
"electron": "33.2.1",
"electron-builder": "24.9.1",
"electron-notarize": "1.0.0",
"electron-rebuild": "3.2.9",
Expand Down Expand Up @@ -156,7 +156,7 @@
"lerna": "^3.8.0",
"mobx-react-devtools": "6.0.3",
"mocha": "5.2.0",
"node-abi": "3.54.0",
"node-abi": "3.71.0",
"prettier": "1.15.2",
"react-intl-translations-manager": "5.0.3",
"terser-webpack-plugin": "1.2.1",
Expand Down
60 changes: 31 additions & 29 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
import { webFrame } from 'electron';

import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'mobx-react';
import { syncHistoryWithStore, RouterStore } from 'mobx-react-router';
import { RouterStore, syncHistoryWithStore } from 'mobx-react-router';
import { render } from 'react-dom';
import {
Router, Route, hashHistory, IndexRoute, IndexRedirect,
hashHistory,
IndexRedirect,
Route,
Router,
} from 'react-router';

import '@babel/polyfill';
import smoothScroll from 'smoothscroll-polyfill';

import ServerApi from './api/server/ServerApi';
import LocalApi from './api/server/LocalApi';
import storeFactory from './stores';
import apiFactory from './api';
import actions from './actions';
import apiFactory from './api';
import LocalApi from './api/server/LocalApi';
import ServerApi from './api/server/ServerApi';
import MenuFactory from './lib/Menu';
import TouchBarFactory from './lib/TouchBar';
import * as analytics from './lib/analytics';
import storeFactory from './stores';

import I18N from './I18n';
import AppLayoutContainer from './containers/layout/AppLayoutContainer';
import SettingsWindow from './containers/settings/SettingsWindow';
import RecipesScreen from './containers/settings/RecipesScreen';
import ServicesScreen from './containers/settings/ServicesScreen';
import EditServiceScreen from './containers/settings/EditServiceScreen';
import AccountScreen from './containers/settings/AccountScreen';
import TeamScreen from './containers/settings/TeamScreen';
import EditUserScreen from './containers/settings/EditUserScreen';
import EditSettingsScreen from './containers/settings/EditSettingsScreen';
import InviteSettingsScreen from './containers/settings/InviteScreen';
import WelcomeScreen from './containers/auth/WelcomeScreen';
import AuthLayoutContainer from './containers/auth/AuthLayoutContainer';
import ImportScreen from './containers/auth/ImportScreen';
import InviteScreen from './containers/auth/InviteScreen';
import LoginScreen from './containers/auth/LoginScreen';
import PasswordScreen from './containers/auth/PasswordScreen';
import SignupScreen from './containers/auth/SignupScreen';
import ImportScreen from './containers/auth/ImportScreen';
import PricingScreen from './containers/auth/PricingScreen';
import InviteScreen from './containers/auth/InviteScreen';
import SetupAssistentScreen from './containers/auth/SetupAssistantScreen';
import AuthLayoutContainer from './containers/auth/AuthLayoutContainer';
import SignupScreen from './containers/auth/SignupScreen';
import WelcomeScreen from './containers/auth/WelcomeScreen';
import AppLayoutContainer from './containers/layout/AppLayoutContainer';
import AccountScreen from './containers/settings/AccountScreen';
import EditServiceScreen from './containers/settings/EditServiceScreen';
import EditSettingsScreen from './containers/settings/EditSettingsScreen';
import EditUserScreen from './containers/settings/EditUserScreen';
import InviteSettingsScreen from './containers/settings/InviteScreen';
import RecipesScreen from './containers/settings/RecipesScreen';
import ServicesScreen from './containers/settings/ServicesScreen';
import SettingsWindow from './containers/settings/SettingsWindow';
import TeamScreen from './containers/settings/TeamScreen';
import SubscriptionPopupScreen from './containers/subscription/SubscriptionPopupScreen';
import WorkspacesScreen from './features/workspaces/containers/WorkspacesScreen';
import EditWorkspaceScreen from './features/workspaces/containers/EditWorkspaceScreen';
import { WORKSPACES_ROUTES } from './features/workspaces';
import AnnouncementScreen from './features/announcements/components/AnnouncementScreen';
import { ANNOUNCEMENTS_ROUTES } from './features/announcements';
import { isMac } from './environment';
import { ANNOUNCEMENTS_ROUTES } from './features/announcements';
import AnnouncementScreen from './features/announcements/components/AnnouncementScreen';
import { WORKSPACES_ROUTES } from './features/workspaces';
import EditWorkspaceScreen from './features/workspaces/containers/EditWorkspaceScreen';
import WorkspacesScreen from './features/workspaces/containers/WorkspacesScreen';

// Add Polyfills
smoothScroll.polyfill();
Expand Down Expand Up @@ -110,7 +112,7 @@ window.addEventListener('load', () => {
</Route>
<Route path="/payment/:url" component={SubscriptionPopupScreen} />
<Route path="*">
<IndexRedirect to='/' />
<IndexRedirect to="/" />
</Route>
</Router>
</I18N>
Expand Down
6 changes: 3 additions & 3 deletions src/components/ui/FeatureList.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Component } from 'react';
import { defineMessages, intlShape } from 'react-intl';

import { FeatureItem } from './FeatureItem';
import { PLANS } from '../../config';
import { FeatureItem } from './FeatureItem';

const messages = defineMessages({
availableRecipes: {
Expand Down Expand Up @@ -139,7 +139,7 @@ export class FeatureList extends Component {

return (
<ul className={className}>
{features.map(feature => <FeatureItem name={intl.formatMessage(feature)} className={featureClassName} />)}
{features.map(feature => <FeatureItem key={feature.id} name={intl.formatMessage(feature)} className={featureClassName} />)}
</ul>
);
}
Expand Down
18 changes: 16 additions & 2 deletions src/electron/ipc-api/overlayWindow.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { BrowserWindow, ipcMain, webContents } from 'electron';
import {
BrowserWindow, ipcMain,
webContents,
} from 'electron';
// eslint-disable-next-line import/no-named-default
import { isDevMode, isLinux, isMac } from '../../environment';
import { OVERLAY_OPEN } from '../../ipcChannels';
import { OVERLAY_OPEN, RELAY_MESSAGE } from '../../ipcChannels';

const debug = require('debug')('Franz:ipcApi:overlayWindow');

Expand Down Expand Up @@ -66,6 +69,17 @@ export function openOverlay(mainWindow: BrowserWindow, settings: any, args: IArg
});

window.on('close', () => resolve('closed'));

// ipc messages
ipcMain.on(RELAY_MESSAGE, (event, channel, ...data) => {
const mainWindowWebContentsId = mainWindow.webContents.id;

if (event.sender.id === mainWindowWebContentsId) {
window.webContents.send(channel, event.sender.id, ...data);
} else {
mainWindow.webContents.send(channel, event.sender.id, ...data);
}
});
} catch (err) {
console.log(err);
resolve('error');
Expand Down
Loading

0 comments on commit 1ba0d5a

Please sign in to comment.