Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Commit

Permalink
display migration dialog
Browse files Browse the repository at this point in the history
Display a dialog on startup to inform the user about Google's decision
to discontinue Inbox. The dialog explains which versions work with
Inbox and which with Gmail.

We add a new config setting 'displayMigrationInfo' to allow the user
to forever dismiss the dialog.
  • Loading branch information
Jose Marino committed Mar 11, 2019
1 parent 6093e68 commit 3df06ea
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/main/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ module.exports = new ElectronStore({
period: 2,
},
sendAnalytics: true,
displayMigrationInfo: true,
},
});
36 changes: 35 additions & 1 deletion app/main/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const {
app, BrowserWindow, Menu, shell, ipcMain, nativeImage, Notification,
app, BrowserWindow, Menu, shell, ipcMain, nativeImage, Notification, dialog,
} = require('electron');
const log = require('electron-log');
const isDev = require('electron-is-dev');
Expand Down Expand Up @@ -97,6 +97,39 @@ function createMainWindow() {
return win;
}

// Inform the user about Google's plan to discontinue Inbox
function showMigrationDialog() {
if (config.get('displayMigrationInfo') === 'no 1.2.x') { // indicates dialog was dismissed from version 1.2.x
return;
}

const message = 'This version of Inboxer will stop working after March 2019';
const detail = `Google has announced plans to discontinue Inbox at the end of March 2019. \
See Google's official announcement here:
https://www.blog.google/products/gmail/inbox-signing-find-your-favorite-features-new-gmail/
Versions >= 1.3.0 have been migrated from Inbox to Gmail to ensure Inboxer continues \
to work after Google pulls the plug on Inbox.
Versions 1.2.x will continue working with Inbox until the bitter end.`;

dialog.showMessageBox(mainWindow, {
type: 'info',
icon: nativeImage.createFromPath(path.join(__dirname, '..', 'static/Icon.png')),
title: 'Important Message',
message,
detail,
checkboxLabel: 'Show this window again',
checkboxChecked: true,
buttons: ['Ok'],
defaultId: 0,
}, (response, checkBoxChecked) => {
if (!checkBoxChecked) {
config.set('displayMigrationInfo', 'no 1.2.x');
}
});
}


app.on('ready', () => {
Menu.setApplicationMenu(appMenu);
mainWindow = createMainWindow();
Expand All @@ -114,6 +147,7 @@ app.on('ready', () => {

webContents.on('dom-ready', () => {
webContents.insertCSS(fs.readFileSync(path.join(__dirname, '../renderer/browser.css'), 'utf8'));
showMigrationDialog();
});

webContents.on('will-navigate', (e, url) => {
Expand Down

0 comments on commit 3df06ea

Please sign in to comment.