mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-20 15:26:06 +08:00
Replace electron-lets-move with new Electron API #821
This commit is contained in:
parent
e427096848
commit
3133b3f70d
15
app/package-lock.json
generated
15
app/package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mailspring",
|
||||
"version": "1.1.5",
|
||||
"version": "1.2.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1241,14 +1241,6 @@
|
|||
"resolved": "https://registry.npmjs.org/editions/-/editions-1.3.3.tgz",
|
||||
"integrity": "sha1-CQcQG92iD6w8vjNMJ8vQaI3Jmls="
|
||||
},
|
||||
"electron-lets-move": {
|
||||
"version": "0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/electron-lets-move/-/electron-lets-move-0.0.5.tgz",
|
||||
"integrity": "sha1-wM51Psyr6rYsMpDIX9tYKHmEbGU=",
|
||||
"requires": {
|
||||
"sudo-prompt": "6.2.1"
|
||||
}
|
||||
},
|
||||
"electron-remote": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/electron-remote/-/electron-remote-1.2.0.tgz",
|
||||
|
@ -3904,11 +3896,6 @@
|
|||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
|
||||
},
|
||||
"sudo-prompt": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/sudo-prompt/-/sudo-prompt-6.2.1.tgz",
|
||||
"integrity": "sha1-EHkhGsLPIfUjD/vrEk/8Is7kwrY="
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
"classnames": "1.2.1",
|
||||
"collapse-whitespace": "^1.1.6",
|
||||
"debug": "github:emorikawa/debug#nylas",
|
||||
"electron-lets-move": "0.0.5",
|
||||
"electron-spellchecker": "1.1.2",
|
||||
"emoji-data": "^0.2.0",
|
||||
"enzyme": "3.3.0",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* eslint global-require: "off" */
|
||||
|
||||
import { BrowserWindow, Menu, app, ipcMain, dialog, powerMonitor } from 'electron';
|
||||
import { moveToApplications } from 'electron-lets-move';
|
||||
|
||||
import fs from 'fs-plus';
|
||||
import url from 'url';
|
||||
|
@ -18,6 +17,7 @@ import SystemTrayManager from './system-tray-manager';
|
|||
import DefaultClientHelper from '../default-client-helper';
|
||||
import MailspringProtocolHandler from './mailspring-protocol-handler';
|
||||
import ConfigPersistenceManager from './config-persistence-manager';
|
||||
import moveToApplications from './move-to-applications';
|
||||
import MailsyncProcess from '../mailsync-process';
|
||||
|
||||
let clipboard = null;
|
||||
|
@ -170,17 +170,8 @@ export default class Application extends EventEmitter {
|
|||
if (this.config.get('askedAboutAppMove')) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await moveToApplications();
|
||||
this.config.set('askedAboutAppMove', true);
|
||||
} catch (err) {
|
||||
dialog.showMessageBox({
|
||||
type: 'warning',
|
||||
buttons: ['Okay'],
|
||||
message: `We encountered a problem moving to the Applications folder. Try quitting the application and moving it manually.`,
|
||||
detail: err.toString(),
|
||||
});
|
||||
}
|
||||
this.config.set('askedAboutAppMove', true);
|
||||
moveToApplications();
|
||||
}
|
||||
|
||||
async oneTimeAddToDock() {
|
||||
|
|
33
app/src/browser/move-to-applications.es6
Normal file
33
app/src/browser/move-to-applications.es6
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { app, dialog } from 'electron';
|
||||
|
||||
export default function moveToApplications() {
|
||||
if (app.isInApplicationsFolder()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// prompt the user and ask if they'd like to move the application
|
||||
const idx = dialog.showMessageBox({
|
||||
type: 'question',
|
||||
buttons: ['Move to Applications', 'Not Now'],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
title: 'Move to Applications?',
|
||||
message:
|
||||
'Thanks for downloading Mailspring! Would you like to move it to your Applications folder?',
|
||||
});
|
||||
|
||||
// move ourselves to the applications folder. This throws errors as necessary,
|
||||
// and quits / relaunches the app if successful
|
||||
if (idx === 0) {
|
||||
try {
|
||||
app.moveToApplicationsFolder();
|
||||
} catch (err) {
|
||||
dialog.showMessageBox({
|
||||
type: 'warning',
|
||||
buttons: ['Okay'],
|
||||
message: `We encountered a problem moving to the Applications folder. Try quitting the application and moving it manually.`,
|
||||
detail: err.toString(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
13098
package-lock.json
generated
Normal file
13098
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue