Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
0fba9ea
WIP: Relates to #312. Initial setup using menubar library
ltfschoen Jan 4, 2019
4cc3a6a
feat: Update Readme. Add taskbar icon. Tweak taskbar window size. Cha…
ltfschoen Jan 4, 2019
c5aa7d7
refactor: Remove temporary hello world file
ltfschoen Jan 4, 2019
a280b07
Merge branch 'master' into luke-312-taskbar-app
ltfschoen Jan 4, 2019
730fd87
docs: Update Readme to include building before running
ltfschoen Jan 4, 2019
02b0d95
docs: Move onto separate line
ltfschoen Jan 4, 2019
b2a4092
fix: Update Onboarding component and make Terms & Conditions consiste…
ltfschoen Jan 5, 2019
64f65f4
fix: Add white background body element so Onboarding background consi…
ltfschoen Jan 5, 2019
c204424
feat: Change mainWindow file extension to TypeScript file
ltfschoen Jan 6, 2019
ff1a7e5
feat: Create FetherWindow class
ltfschoen Jan 6, 2019
3a1c9d7
refactor: Move FetherWindow component into module folder. Fix its type
ltfschoen Jan 6, 2019
c703da0
refactor: Rename fetherWindow to app
ltfschoen Jan 6, 2019
7e91f70
refactor: Rename FetherWindow to FetherApp. fetherApp var stores window
ltfschoen Jan 6, 2019
60027ca
fix: Change back to JS from TS
ltfschoen Jan 6, 2019
5abd34a
fix: Replace TS with Babel.js in fether-electron
ltfschoen Jan 6, 2019
a17aaf0
refactor: Move FetherApp options into FetherAppOptions class
ltfschoen Jan 6, 2019
7a9a81b
refactor: Move download, installation, and running of Parity Ethereum…
ltfschoen Jan 6, 2019
5610464
refactor: Move into default options.index the Electron start url
ltfschoen Jan 6, 2019
9ed899c
refactor: Move all FetherApp dependencies into subfolders within app …
ltfschoen Jan 6, 2019
d101121
fix: isRunning boolean returned to .then
ltfschoen Jan 6, 2019
30abe60
fix: Add hasVisibleWindows and event to activate Electron listener
ltfschoen Jan 6, 2019
70ebf94
docs: Add Fixme
ltfschoen Jan 6, 2019
4763ac0
refactor: Integrate menubar. Separate logic for taskbar app. See comm…
ltfschoen Jan 7, 2019
7b0873b
refactor: Remove menubar demo and dependency
ltfschoen Jan 7, 2019
36c5399
Merge branch 'master' into luke-312-taskbar-app
ltfschoen Jan 7, 2019
ae917cc
refactor: Destructuring of fetherApp properties
ltfschoen Jan 7, 2019
b63313b
feat: Replace taskbar icon with Parity Ethereum Fether instead of Par…
ltfschoen Jan 7, 2019
666bbb5
feat: Add method for fetherApp event listener handlers setup and move…
ltfschoen Jan 7, 2019
57e3c7e
feat: Add EventListener error listener
ltfschoen Jan 7, 2019
f29672a
fix: Fix so that it shows the window automatically when loaded in tas…
ltfschoen Jan 7, 2019
c8e7b90
fix: Fix naming of event listeners so they match. Reorder in order th…
ltfschoen Jan 8, 2019
794ae5c
feat: Add security configuration options to Electron. Add progress ba…
ltfschoen Jan 8, 2019
34e52b1
refactor: Add newlines so steps are readable
ltfschoen Jan 8, 2019
03d9e80
Merge branch 'master' into luke-312-taskbar-app
ltfschoen Jan 8, 2019
41e1b03
feat: Makde body element draggable
ltfschoen Jan 9, 2019
aa232ae
feat: Configure window to be alwaysOnTop
ltfschoen Jan 9, 2019
17c4a2b
fix: Save window and restore within bounds of tray when restored
ltfschoen Jan 9, 2019
0bf4455
WIP: Fixes window position when screen resolution reduced. Restores t…
ltfschoen Jan 9, 2019
9fe0756
WIP: Refactor by moving some code into settings and utils/window
ltfschoen Jan 9, 2019
eb673a8
test: Setup fether-electron tests. Add tests for Fether window
ltfschoen Jan 9, 2019
d64bb09
fix: Fix semicolon wrong place
ltfschoen Jan 10, 2019
4ea5ae0
WIP: Add classes and elements for no-drag, or no user selection
ltfschoen Jan 10, 2019
c561f1e
merge latest from master and fix conflicts
ltfschoen Jan 10, 2019
b2a4a07
review-fix: Try to make token cards clickable on account page. Try fu…
ltfschoen Jan 11, 2019
70ff7eb
remove console.logs
ltfschoen Jan 13, 2019
e38bff0
feat: Add automatic opening of DevTools when flag provided
ltfschoen Jan 13, 2019
ea8c837
merge latest master and fix merge conflicts
ltfschoen Jan 20, 2019
eca0023
Merge branch 'master' into luke-312-taskbar-app
ltfschoen Jan 21, 2019
5f4f205
WIP: Saves position windows. Incorrect screen dims being used. Debugging
ltfschoen Jan 21, 2019
893cd5e
WIP - move window up into view when window bottom of screen and navig…
ltfschoen Jan 22, 2019
4fbd36f
refactor: Move Electron menu template into separate file. Create even…
ltfschoen Jan 22, 2019
32d1bc5
fix: Use window after defined
ltfschoen Jan 22, 2019
8ce7add
feat: Add context menu on right click for Windows
ltfschoen Jan 22, 2019
ffffaa9
feat: Toggle Fether menu with ALT-M in Windows but menu items do not …
ltfschoen Jan 22, 2019
61ab4ef
refactor: Remove useless debugger
ltfschoen Jan 22, 2019
85197a7
fix: Fix missing code
ltfschoen Jan 22, 2019
d20f255
refactor: Remove console.logs
ltfschoen Jan 22, 2019
84ee045
refactor: Cleanup console.log
ltfschoen Jan 22, 2019
f6e811e
fix: Only run hookWindowMessage on Windows
ltfschoen Jan 23, 2019
9bb328d
Disable taskbar app mode on linux
ltfschoen Jan 23, 2019
ab04406
WIP - Fether menu window frame on Windows and Feedback adjust
ltfschoen Jan 23, 2019
bc8a6dd
Show Fether menu in frame always on Windows
ltfschoen Jan 23, 2019
21e20b1
Hide menu bar by default. Comment out code that not working
ltfschoen Jan 23, 2019
7460b19
fix comment
ltfschoen Jan 23, 2019
418ce12
Merge branch 'master' into luke-312-taskbar-app
ltfschoen Jan 24, 2019
0f373a1
fix: Recover save position and show icon on Windows
ltfschoen Jan 24, 2019
a81b1a9
refactor: Move showTrayBalloon into own method
ltfschoen Jan 24, 2019
ff88225
fix: Add missing options prop
ltfschoen Jan 24, 2019
6e8aafc
feat: Run showTrayBalloon when Fether window is maximised or restored
ltfschoen Jan 24, 2019
710a582
docs: Update Readme
ltfschoen Jan 24, 2019
c0b3fa1
feat: Save window position on Linux. Refactor events
ltfschoen Jan 25, 2019
3e606c2
fix: Fix save windows position on minimise on Linux. Add taskbar usag…
ltfschoen Jan 26, 2019
aad638b
fix: Reduce debounce to 1s so on Linux if crash 1s after move it save…
ltfschoen Jan 26, 2019
e68c763
fix: Minimise should only save position, not kill window object too
ltfschoen Jan 26, 2019
2068b60
fix: Fix so unregisters relevant listeners when click close button in…
ltfschoen Jan 26, 2019
3ae04f8
docs: Update Readme with Windows non-taskbar info
ltfschoen Jan 26, 2019
9359890
Move icons to static folder
amaury1093 Jan 30, 2019
a20c55f
Merge pull request #396 from paritytech/am-312-taskbar-app
ltfschoen Jan 30, 2019
83114f1
fix: Remove unused image
ltfschoen Jan 30, 2019
b8c1a82
chore: Add copyright to electron-builder config
ltfschoen Jan 31, 2019
9bbff3e
fix: Add new taskbar icons with higher DPI
ltfschoen Jan 31, 2019
d2acf13
temp: Try adding more icons to see how to increase windows taskbar ic…
ltfschoen Jan 31, 2019
e313366
chore: Remove all useless icons that do not chagne poor quality icon …
ltfschoen Jan 31, 2019
f6341a2
fix: Prevent removalAllListeners of undefined error when close window…
ltfschoen Jan 31, 2019
aa5abc1
feat: Add Windows icon
ltfschoen Jan 31, 2019
0c0788c
review-fix: Remove blue background highlight from tray icon on macOS
ltfschoen Jan 31, 2019
b4d3a3b
refactor: State that downloading Parity Ethereum precisely
ltfschoen Jan 31, 2019
955bcad
review-fix: Remove craco and extend dependencies
ltfschoen Jan 31, 2019
7aa59ce
review-fix: Replace console.logs with pino
ltfschoen Jan 31, 2019
dfb3f7b
test: Update package.json to use Jest with colours
ltfschoen Jan 31, 2019
7c9eb5f
test: Setup Jest
ltfschoen Jan 31, 2019
1807ca2
test: Mock pino.info to pass Fether window tests in Fether Electron
ltfschoen Jan 31, 2019
22ed464
test: Fix pipelineOperator error that was failing tests
ltfschoen Jan 31, 2019
d293a7d
test: Fix Babel decorators plugin errors
ltfschoen Jan 31, 2019
d2c41d0
test: Fix all failing tests
ltfschoen Feb 1, 2019
cc280b7
fix: Remove Babel plugins that broke yarn electron build but are unne…
ltfschoen Feb 1, 2019
cc9ece9
refactor: Remove unnecessary use of extend library dependency and use…
ltfschoen Feb 1, 2019
a246b80
review-fix: Convert FetherApp options into function instead of class
ltfschoen Feb 1, 2019
546e44d
fix: Do not show taskbar icon when run in TASKBAR=false mode
ltfschoen Feb 1, 2019
2dccca1
review-fix: Convert FetherApp class create method into constructor
ltfschoen Feb 1, 2019
c04a3ac
refactor: Move FetherApp methods into methods folder
ltfschoen Feb 1, 2019
e0b77f7
fix: Fix config
ltfschoen Feb 2, 2019
00c95b0
refactor: Move setup of listeners to end
ltfschoen Feb 2, 2019
79ea08a
fix: Return menu from getMenu
ltfschoen Feb 2, 2019
1f2a846
chore: Replace small tray icon with white on black icon
ltfschoen Feb 2, 2019
b7478ea
feat: Change taskbar icons to white on transparent with 5x sizes
ltfschoen Feb 2, 2019
8e4919e
fix: Improve 16x16 icon monotone transparent
ltfschoen Feb 2, 2019
389873b
remove old 16x16 icon
ltfschoen Feb 2, 2019
9757370
add new 16x16 icon
ltfschoen Feb 2, 2019
a1aa02e
move old tray icons
ltfschoen Feb 2, 2019
2819f62
chore: Tray icon rename old white background icons. Windows use .ico …
ltfschoen Feb 2, 2019
d478303
remove 16x16 tray icon since invisible on non-retina
ltfschoen Feb 2, 2019
e42e8f5
replace with new 16x16 tray icon
ltfschoen Feb 2, 2019
dc3d47e
move white 16x16 tray icon to old since non-retina has white backgrou…
ltfschoen Feb 2, 2019
3edd2cb
fix: Add 16x16 black icon for non-retina since tray background is white
ltfschoen Feb 2, 2019
a9592c4
remove old 16x16 non-retina tray icon since bad shape
ltfschoen Feb 2, 2019
091238b
fix: Add new 16x16 non-retina with tweaked shape
ltfschoen Feb 2, 2019
f2f2736
remove old 16x16 non-retina tray icon since bad shape
ltfschoen Feb 2, 2019
1cacdea
fix: Add new 16x16 non-retina with tweaked shape
ltfschoen Feb 2, 2019
3669299
fix: Add dock icon to static folder and set it so it appears in devel…
ltfschoen Feb 3, 2019
aed978a
fix: Rename to __Template so on macOS the image adapts to both light …
ltfschoen Feb 3, 2019
13fd3cc
fix: Rename to use template icon file with _Template postfix on macOS
ltfschoen Feb 3, 2019
c0daacb
refactor: Move mac tray icons into subfolder
ltfschoen Feb 3, 2019
3d4e54c
fix: Add icon.png amongst _Template.png files otherwise does not compile
ltfschoen Feb 3, 2019
56dd39b
fix: Fix quality of icon used in balloon on Windows to be 64x64px
ltfschoen Feb 3, 2019
bf5dbf9
merge latest from master
ltfschoen Feb 5, 2019
adf8737
review-fix: Fix incorrectly loaded path dependency
ltfschoen Feb 5, 2019
3f3d288
fix: Fixes Cannot read getGlobal of undefined since remote must be en…
ltfschoen Feb 5, 2019
27ca625
review-fix: Remove empty craco config file from fether electron
ltfschoen Feb 5, 2019
dba6a22
fix: Add changes made in PR #403 to fix bug #401
ltfschoen Feb 5, 2019
0d9f269
test: Update to latest Babel 7 plugins following migration guide and …
ltfschoen Feb 5, 2019
e9b95dc
WIP
ltfschoen Feb 5, 2019
6ad5502
WIP - Refactor methods to be directly associated with class. Yet to d…
ltfschoen Feb 5, 2019
32d53c6
refactor: Remove double quotes
ltfschoen Feb 5, 2019
1867a83
refactor: Reorder methods alphabetically
ltfschoen Feb 5, 2019
8115e9b
refactor: Remove double quotes
ltfschoen Feb 5, 2019
9d5c0f1
refactor: Remove eslint-disable-lines since no longer used
ltfschoen Feb 5, 2019
48e5bd6
refactor: Update according to eslint recommendation
ltfschoen Feb 5, 2019
fcb43a9
refactor: Rename thatFA to fetherApp now that everythings in order
ltfschoen Feb 5, 2019
b561844
refactor: Polishing up. Shorten names and destructuring
ltfschoen Feb 5, 2019
6c06a36
fix: Fix linting errors
ltfschoen Feb 5, 2019
18c9536
refactor: Rename files to match function names
ltfschoen Feb 5, 2019
dbf6dab
fix: Use constructor when creating ParityEthereum class instance
ltfschoen Feb 5, 2019
0387a3f
fix: Must pass context of fetherApp as argument to different methods
ltfschoen Feb 5, 2019
22d7c13
review-fix: Remove commented out old event emitter line of code
ltfschoen Feb 5, 2019
dd47b9b
WIP - attempt to address review comments
ltfschoen Feb 5, 2019
7ec1855
WIP
ltfschoen Feb 5, 2019
2673b0c
WIP - use craco in fether-react, and jest in fether-electron, as inst…
ltfschoen Feb 5, 2019
3aecfba
WIP - restore fether-electron's babel.config.js so tests pass
ltfschoen Feb 5, 2019
688ceca
chore: Restore newer versions since tests still pass
ltfschoen Feb 5, 2019
fd8615f
Merge pull request #406 from paritytech/luke-312-taskbar-tests
ltfschoen Feb 5, 2019
b497ba2
fix: Do not show balloon message every time ALT key is pressed on Win…
ltfschoen Feb 5, 2019
9e0b9b7
chore: Update yarn.lock
ltfschoen Feb 5, 2019
ea705cd
test: Update fether-react test command per Axel recommendation in PR …
ltfschoen Feb 5, 2019
af9340f
merge latest master and fix conflicts
ltfschoen Feb 5, 2019
b8ec52b
chore: Revert to using older version of commander
ltfschoen Feb 5, 2019
2b5a97d
Merge branch 'master' into luke-312-taskbar-app
ltfschoen Feb 5, 2019
060d7d3
feat: Show frame on Linux too. Menu visible on load for non-macOS. Re…
ltfschoen Feb 5, 2019
21b974c
fix: Remove unnecessary leftover .apply
ltfschoen Feb 5, 2019
80accae
refactor: Move menu logic into setupMenu method
ltfschoen Feb 5, 2019
510b7e9
fix: createWindow may be called from showWindow too, but we were not …
ltfschoen Feb 6, 2019
1210a11
fix: Allow dev tools in production
ltfschoen Feb 6, 2019
66f2820
fix: Fix bug where Fether window closed and webrequest received when …
ltfschoen Feb 6, 2019
f1d7792
fix: Fix error when click tray icon to re-open Fether window after ch…
ltfschoen Feb 6, 2019
b4318da
fix: Resize Fether window on Windows with additional height upon load…
ltfschoen Feb 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,59 @@ yarn package
yarn start
```

> Troubleshooting: If it hangs on a white screen in Electron even though it has compiled and has been syncing for a long time, then simply choose 'View > Reload' (CMD + R on macOS) from the Electron menu
> Troubleshooting: If it hangs on a white screen in Electron even though it has compiled and has been syncing for a long time, then simply choose 'View > Reload' (CMD + R on macOS) from the Fether/Electron menu. If the Fether menu is not shown in the tray, then by clicking the Fether window and then holding down the ALT key to reveal it.

> Developer Tools: Open developer tools automatically by running `DEBUG=true yarn start` when not in the production environment

# Run without taskbar mode (no tray icon)

```bash
TASKBAR=false yarn start
```

# Usage of taskbar mode

### macOS

Taskbar mode is `true` by default.

* Enabled `true`
* Fether window may be toggled open/closed by clicking the Fether tray icon, but not the Fether dock icon
* Fether window does not have a frame (i.e. no close/minimise icons)
* Disabled `false`
* Fether window may be toggled open by clicking the Fether dock icon
* Fether window has a frame (with close/minimise icons)
* Always
* Fether menu shown in the tray by default
* Fether window position is saved upon move, minimising, and close so it is restored in the same position.

### Linux

Taskbar mode is `true` by default.

* Enabled `true`
* Fether window may be toggled minimise/restore by clicking the Fether tray icon to reveal a tooltip that says "Click to toggle Fether window" and then clicking the tooltip.
* Fether window may not have a frame (i.e. no close/minimise icons) if `frame: false` in packages/fether-electron/src/main/app/options/config/index.js
* Disabled `false`
* Fether window may be toggled open by clicking the Fether dock icon
* Fether window has a frame (with close/minimise icons)
* Always
* Fether menu may not be not shown in the tray by default depending on whether `setMenuBarVisibility` has been set. Show the Fether menu in the tray by clicking the Fether window and then holding down the ALT key to reveal it.
* Fether menu may be configured to automatically hide by setting `setAutoHideMenuBar`
* Fether window position is saved upon move, minimising, and close so it is restored in the same position.

### Windows

Taskbar mode is always `false` since the Fether menu does not appear without a frame on the Fether window.

* Disabled `false`
* Fether window may be toggled open/minimise by clicking the Fether dock icon
* Fether window has a frame (with close/minimise icons).
* Always
* Fether menu is shown in the Fether window by clicking the Fether window and then holding down the ALT key to reveal it.
* Fether menu may be configured to automatically hide by setting `setAutoHideMenuBar`
* Fether tray icon does nothing
* Fether window position is saved upon move, minimising, and close so it is restored in the same position.

## Join the chat!

Expand Down
4 changes: 4 additions & 0 deletions packages/fether-electron/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
plugins: [['@babel/plugin-proposal-class-properties', { loose: false }]],
presets: ['@babel/preset-env']
};
Binary file added packages/fether-electron/build/icons/icon.ico
Binary file not shown.
2 changes: 2 additions & 0 deletions packages/fether-electron/electron-builder.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"appId": "io.parity.fether",
"copyright": "Copyright 2015-2018 Parity Technologies (UK) Ltd.",
"linux": {
"category": "Utility",
"target": ["AppImage", "snap", "deb", "tar.xz"]
Expand All @@ -10,6 +11,7 @@
"productName": "Parity Fether",
"publish": "github",
"win": {
"icon": "icons/icon.ico",
"publisherName": "Parity Technologies (UK) Ltd.",
"target": "nsis"
}
Expand Down
14 changes: 8 additions & 6 deletions packages/fether-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,26 @@
"prerelease": "./scripts/revertElectronBug.sh",
"release": "electron-builder",
"start": "cross-env ELECTRON_START_URL=http://localhost:3000 electron-webpack dev --ws-origins all",
"test": "echo Skipped."
"test": "jest --all --color --coverage"
},
"dependencies": {
"@parity/electron": "^4.0.0",
"ansi-styles": "^3.2.1",
"commander": "^2.15.1",
"commander-remaining-args": "^1.2.0",
"electron-positioner": "^4.1.0",
"electron-settings": "^3.2.0",
"fether-react": "^0.3.0",
"pino": "^4.16.1",
"pino-multi-stream": "^3.1.2",
"source-map-support": "^0.5.6"
"source-map-support": "^0.5.10"
},
"devDependencies": {
"copyfiles": "^2.0.0",
"copyfiles": "^2.1.0",
"cross-env": "^5.2.0",
"electron": "^4.0.1",
"electron-builder": "^20.29.0",
"electron-webpack": "^2.1.2",
"webpack": "^4.7.0"
"electron-builder": "^20.38.5",
"electron-webpack": "^2.6.1",
"webpack": "^4.29.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import cli from 'commander';

const { productName } = require('../../../electron-builder.json');
const { version } = require('../../../package.json');
const { productName } = require('../../../../electron-builder.json');
const { version } = require('../../../../package.json');

/**
* Process.argv arguments length is different in electron mode and in packaged
Expand Down
114 changes: 114 additions & 0 deletions packages/fether-electron/src/main/app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause

import EventEmitter from 'events';

import {
calculateWinPosition,
createPositioner,
createTray,
createWindow,
fixWinPosition,
getScreenResolution,
hideWindow,
loadTray,
moveWindowUp,
onTrayClick,
onWindowClose,
processSaveWinPosition,
setupAppListeners,
setupDebug,
setupGlobals,
setupLogger,
setupMenu,
setupParityEthereum,
setupRequestListeners,
setupSecurity,
setupWinListeners,
setupWin32Listeners,
showTrayBalloon,
showWindow,
updateProgress,
windowClear
} from './methods';

let hasCalledInitFetherApp = false;

class FetherApp extends EventEmitter {
constructor (electronApp, options) {
super();

if (hasCalledInitFetherApp) {
this.emit(
'error',
new Error('Unable to initialise Fether app more than once')
);
}

/**
* After the Fether instance and fetherApp.win has been created.
* If the user then chooses from the Fether Menu "Window > Close"
* it runs windowClear, which deletes fetherApp.win and associated
* listeners since the 'close' event also occurs when the user exits.
* If the user then clicks the tray icon to re-open the Fether window,
* it will run the onTrayClick method, which calls fetherApp.showWindow
* and if fetherApp.win does not exist, it runs showWindow and createWindow
* to restore create fetherApp.win again and associated listeners. However we
* do not need to run all the fetherApp methods again like we did on the
* when fetherApp.win was first created (i.e. createTray, loadTray,
* setupDebug, setupSecurity, setupLogger, setupParityEthereum, setupGlobals)
*/
this.app = electronApp;
this.options = options;

this.createWindow();
this.updateProgress(0.4, undefined);

// These methods are called only once when Fether instance is created
// (i.e. not called again when the Fether window closed and re-opened)
this.createTray();
this.loadTray();
this.setupDebug();
this.setupSecurity();
this.setupLogger();
this.setupParityEthereum();
this.setupGlobals();

this.updateProgress(0.8, undefined);
this.showWindow(undefined);
this.updateProgress(1.0, undefined);
this.updateProgress(-1, 'after-create-app');
}

calculateWinPosition = () => calculateWinPosition(this);
createPositioner = () => createPositioner(this);
createTray = () => createTray(this);
createWindow = () => createWindow(this);
fixWinPosition = positionStruct => fixWinPosition(this, positionStruct);
getScreenResolution = () => getScreenResolution();
hideWindow = () => hideWindow(this);
loadTray = () => loadTray(this);
moveWindowUp = () => moveWindowUp(this);
onTrayClick = (e, bounds) => onTrayClick(this, e, bounds);
onWindowClose = () => onWindowClose(this);
processSaveWinPosition = () => processSaveWinPosition(this);
setupAppListeners = () => setupAppListeners(this);
setupDebug = () => setupDebug(this);
setupGlobals = () => setupGlobals();
setupLogger = () => setupLogger();
setupMenu = () => setupMenu(this);
setupParityEthereum = () => setupParityEthereum(this);
setupRequestListeners = () => setupRequestListeners(this);
setupSecurity = () => setupSecurity(this);
setupWinListeners = () => setupWinListeners(this);
setupWin32Listeners = () => setupWin32Listeners(this);
showTrayBalloon = () => showTrayBalloon(this);
showWindow = trayPos => showWindow(this, trayPos);
updateProgress = (percentage, eventListenerName) =>
updateProgress(this, percentage, eventListenerName);
windowClear = () => windowClear(this);
}

export default FetherApp;
21 changes: 21 additions & 0 deletions packages/fether-electron/src/main/app/menu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause

import electron from 'electron';
import { template } from './template';

const { Menu } = electron;

const menu = Menu.buildFromTemplate(template);

const getMenu = () => {
return Menu.getApplicationMenu();
};

const addMenu = () => {
Menu.setApplicationMenu(menu);
};

export { addMenu, getMenu };
87 changes: 87 additions & 0 deletions packages/fether-electron/src/main/app/menu/template/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Copyright 2015-2018 Parity Technologies (UK) Ltd.
// This file is part of Parity.
//
// SPDX-License-Identifier: BSD-3-Clause

import electron from 'electron';

const { app, shell } = electron;

// Create the Application's main menu
// https://github.com/electron/electron/blob/master/docs/api/menu.md#examples
export const template = [
{
label: 'Edit',
submenu: [
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'delete' },
{ role: 'selectall' }
]
},
{
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'forcereload' },
{ role: 'toggledevtools' },
{ type: 'separator' },
{ role: 'resetzoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
},
{
role: 'window',
submenu: [{ role: 'minimize' }, { role: 'close' }]
},
{
role: 'help',
submenu: [
{
label: 'Learn More',
click () {
shell.openExternal('https://parity.io');
}
}
]
}
];

if (process.platform === 'darwin') {
template.unshift({
label: app.getName(),
submenu: [
{ role: 'about' },
{ type: 'separator' },
{ role: 'services', submenu: [] },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' }
]
});

// Edit menu
template[1].submenu.push(
{ type: 'separator' },
{
label: 'Speech',
submenu: [{ role: 'startspeaking' }, { role: 'stopspeaking' }]
}
);

// Window menu
template[3].submenu = [
{ role: 'close' },
{ role: 'minimize' },
{ role: 'zoom' },
{ type: 'separator' },
{ role: 'front' }
];
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ const pino = Pino();
/**
* Handle all asynchronous messages from renderer to main.
*/
export default async (mainWindow, event, action, ...args) => {
export default async (fetherAppWindow, event, action, ...args) => {
try {
if (!action) {
return;
}
switch (action) {
case 'app-resize': {
const [width] = mainWindow.getContentSize();
const [width] = fetherAppWindow.getContentSize();
const newHeight = args[0];
mainWindow.setContentSize(width, Math.round(newHeight) + 2);
const feedbackButtonHeight = 20;
const resizeHeight = newHeight + 2;
const height =
process.platform === 'win32' && fetherAppWindow.isMenuBarVisible()
? resizeHeight + feedbackButtonHeight
: resizeHeight;

fetherAppWindow.setContentSize(width, height);
break;
}
case 'check-clock-sync': {
Expand Down
Loading