Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate system notification to autoUpdater #201

Merged
merged 3 commits into from
Feb 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { app, BrowserWindow, ipcMain } = require('electron');
const { autoUpdater } = require('electron-updater');

// Place a BrowserWindow in center of primary display
const centerOnPrimaryDisplay = require('./app/helpers/center-on-primary-display');
const centerOnPrimaryDisplay = require('./helpers/center-on-primary-display');

// Prevent Linux GPU Bug
// https://github.com/electron/electron/issues/4322
Expand Down
9 changes: 8 additions & 1 deletion app/components/layout/AppUpdate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import React, { PureComponent } from 'react';
import openDialog from '../../renderers/dialog';
import { Circle } from 'rc-progress';
const ipc = require('electron').ipcRenderer
import i18n from '../../../i18n/i18n';
import { Notify } from '../../../helpers/notify';
const ipc = require('electron').ipcRenderer

// Styled Components
import styled, { keyframes } from 'styled-components';
Expand Down Expand Up @@ -104,6 +105,12 @@ class AppUpdate extends PureComponent {
});

ipc.on('update-downloaded', () => {
// Send notification
Notify({
title: i18n.t('dialog:appUpdate:downloaded:title'),
body: i18n.t('dialog:appUpdate:downloaded:message'),
});
// Open Dialog
openDialog(
{
type: 'info',
Expand Down
2 changes: 1 addition & 1 deletion app/renderers/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { BrowserWindow } = require('electron').remote;
// Custom Libs
const sounds = require('../../libs/sounds.js');

const centerOnPrimaryDisplay = require('../helpers/center-on-primary-display');
const centerOnPrimaryDisplay = require('../../helpers/center-on-primary-display');

function showModalWindow(dialogOptions, returnChannel = '', ...rest) {
const width = 450;
Expand Down
6 changes: 6 additions & 0 deletions helpers/notify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const Notify = ({ title, body }) =>
new Notification(title, {
body,
});

module.exports = { Notify };
2 changes: 1 addition & 1 deletion preview/containers/MainContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { compose } from 'recompose';
import { translate } from 'react-i18next';
const ipc = require('electron').ipcRenderer;
import { Notify } from '../helper/notify';
import { Notify } from '../../helpers/notify';

// Actions
import * as ActionsCreator from '../actions';
Expand Down
9 changes: 0 additions & 9 deletions preview/helper/notify.js

This file was deleted.