Commit graph

195 commits

Author SHA1 Message Date
Scott Nonnenberg
0ad35cc0e6
Move electron-config init below our change to appData path 2017-09-14 16:53:48 -07:00
Scott Nonnenberg
69d4a77f1e
Remember window position, size, and maximized/fullscreen status
FREEBIE
2017-09-14 16:53:48 -07:00
Scott Nonnenberg
fd8b8910a3
Eliminate HIDE_DEV_TOOLS environment variable. Hide in test env.
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg
f31125eccc
process.env.NODE_ENV -> environment
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg
255ba58b2e
Enable complete exit of Electron process after grunt unit-tests
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg
5635095d1a
Initial version of grunt unit-tests, tests from command-line
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg
4402a91976
Use correct locale, fall back to en if we don't have translations
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg
b4e3cc0e6c
Load test page and run tests on start when NODE_ENV=test
FREEBIE
2017-09-14 16:53:46 -07:00
lilia
7c6da5a157
Make 'Restart Signal' actually restart Signal
Previously it would just reload the page.

// FREEBIE
2017-09-14 16:53:45 -07:00
lilia
2ccd8c21f3
Limit hidden window behavior to osx
Only on osx is it customary to remain running in the background when the
window is closed.

// FREEBIE
2017-09-14 16:53:45 -07:00
lilia
cfb1e62603
Fix menu on non-darwin 2017-09-14 16:53:45 -07:00
lilia
b5649a6874
Add ability to unhide the window from the renderer
via ipc, for instance if a notification is clicked but the window is
closed/hidden.

// FREEBIE
2017-09-14 16:53:43 -07:00
lilia
d018fa63ff
Add Show option under the Window menu
Window > Show will reveal the mainWindow after it has been closed.

// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
d71250b752
More main process logging
// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
b66a887184
Don't check for updates in the MAS build
// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
ade5e593a7
Add some logging to main process startup sequence
// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
c2014b062d
Don't makeSingleInstance in a MAS build
It seems that makeSingleInstance will always return true in the MAS
build.* Luckily, OSX mostly enforces single-instance for us when opening
the app from Finder. If the user attempts to run a second instance from
the command line, it will create a window but fail to load.

*TODO: Revisit why makeSingleInstance is broken in the MAS build.

// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
84fba7d968
Prevent window navigation
Navigation is the default handler for file drag and drop events on the
window.

// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
c1fa33327d
Allow multi-instance in development 2017-09-14 16:53:41 -07:00
lilia
0c9cca08ba
Draw attention to the window on new messages
// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
ea930d53ae
Set badge count
This is displayed on the launcher icon on linux/mac

// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
44adc04395
Closing the window hides the window on mac
Clicking the dock icon restores it again.

// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
77d5ef2f68
Add spellcheck
As of Electron 1.6.5, this requires disabling the sandbox in order to
get access to the `webFrame` api.

// FREEBIE
2017-09-14 16:53:39 -07:00
lilia
878b15c288
Add node version to debug log
The chrome, electron, and signal versions are already included in the
user agent string.

// FREEBIE
2017-09-14 16:53:39 -07:00
lilia
46b0146a4c
Log user data directory 2017-09-14 16:53:38 -07:00
lilia
934d06b512
Override environment vars in production
Don't allow environment vars to muck with configs in production.

// FREEBIE
2017-09-14 16:53:38 -07:00
lilia
14b65a9dce
Log on app ready 2017-09-14 16:53:38 -07:00
lilia
a55c61a3ba
Use local var environment rather than NODE_ENV
Traditionally, NODE_ENV refers to an environment variable. For clarity,
let's keep it that way and don't reuse it in the renderer. Also, add a
note about explicitly overriding env vars for node-config.

// FREEBIE
2017-09-14 16:53:38 -07:00
lilia
e7e030a5e2
Build expiration date
Add the buildExpiration config and add it to the renderer's config
object. Use grunt to write the build expiration to
config/local-production.json which will override the default value (no
expiration) in production. Finally, run this grunt task as part of the
build process.

// FREEBIE
2017-09-14 16:53:38 -07:00
lilia
d0fc2f7e71
Ensure that package.json environment > NODE_ENV
We only set the environment in package.json when it is packaged for
deployment. When we do that, we don't want to allow a local environment
variable to override it.

// FREEBIE
2017-09-14 16:53:38 -07:00
lilia
c83dbc1bf0
Rename window.env to window.config
Also normalize to camelCase for configs.

// FREEBIE
2017-09-14 16:53:38 -07:00
lilia
590284e4cb
Open links in the default browser 2017-09-14 16:53:37 -07:00
lilia
9f47ff9040
Adjust initial window size 2017-09-14 16:53:37 -07:00
lilia
7e1bee1082
Configure app/build using node config
Add environment-specific configs under `./config` and integrate with the
build system. Also changes package.json `files` from blacklist to
whitelist.

// FREEBIE
2017-09-14 16:53:36 -07:00
lilia
449c3e2428
Don't auto-open devtools in prod 2017-09-14 16:53:36 -07:00
lilia
e112217095
Add standard menus 2017-09-14 16:53:36 -07:00
lilia
3b287185ef
Fix autoUpdater error in development 2017-09-14 16:53:35 -07:00
lilia
86d703bc87
Fix debug log 2017-09-14 16:53:35 -07:00
lilia
63657db3be
Quick fix for i18n
Just use the english locale for now. Load locale data from the
filesystem in the main process and pass it to the renderer preload
script via ipc. Note that we need the locale data to be available by the
time view scripts are loaded.

// FREEBIE
2017-09-14 16:53:35 -07:00
lilia
2bbd0d58c6
Separate development and production environments
Set NODE_ENV at run time or build time to switch the app between dev and
production modes.

At build time, the current NODE_ENV will be included in the packaged
app's package.json file. At runtime we read NODE_ENV from package.json,
but also allow the local environment variable to override. A query
string parsed by a preload script exposes the value to the renderer,
which then determines whether we use the staging or production server.
Additionally, different environments have different user data
directories.

// FREEBIE
2017-09-14 16:53:35 -07:00
lilia
b176bd756c
Ensure app is single-instance
Remove some comments.

// FREEBIE
2017-09-14 16:53:35 -07:00
lilia
f4df38735c
Enable sandbox
// FREEBIE
2017-09-14 16:53:35 -07:00
lilia
28e5c04633
Set AUMID to appId
It is also important to set the Application User Model ID (AUMID) to the
appId of the application, in order for notifications on Windows 8/8.1 to
function and for Window 10 notifications to display the app icon within
the notifications by default. The AUIMD should be set within the Main
process and before any BrowserWindows have been opened, it is normally
the first piece of code executed.

https://github.com/electron-userland/electron-builder/wiki/NSIS#guid-vs-application-name

// FREEBIE
2017-09-14 16:53:34 -07:00
lilia
dcc6f599a2
Auto-update hourly 2017-09-14 16:53:34 -07:00
lilia
2cf7ea0a94
Hello Electron
In package.json, define our main entry point for electron, and add a
node script to start it up.

Add main.js from Electron/electron-quick-start with two modifications.
1. Load background.html instead of index.html
2. Disable node integration in the renderer

At this point we can load the background page in a window
with `npm start`, though it currently breaks on missing chrome app APIs.

// FREEBIE
2017-09-14 16:53:28 -07:00