From bc4b6969668b480628dc0e016c1b516aa0cbea92 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 20 Mar 2019 16:15:07 +0100 Subject: [PATCH 1/8] MOBILE-2835 desktop: Remove data when unistall nsis --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 0c5fc0d62..2ca42cae4 100644 --- a/package.json +++ b/package.json @@ -227,6 +227,9 @@ }, "snap": { "confinement": "classic" + }, + "nsis": { + "deleteAppDataOnUninstall": true } } } From daa34a7caad3ec6ff451ef5ceb65ed312192074a Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 16 Apr 2019 18:23:22 +0200 Subject: [PATCH 2/8] MOBILE-2986 desktop: Add shortcut to open dev tools --- desktop/electron.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/desktop/electron.js b/desktop/electron.js index 343f81a5b..5e10f57b7 100644 --- a/desktop/electron.js +++ b/desktop/electron.js @@ -68,6 +68,14 @@ function createWindow() { // Append some text to the user agent. mainWindow.webContents.setUserAgent(mainWindow.webContents.getUserAgent() + ' ' + userAgent); + + // Add shortcut to open dev tools: Control/Cmd + Alt + I. + mainWindow.webContents.on('before-input-event', function(e, input) { + // The "meta" key is Cmd in MacOS and Control in Windows/Linux. + if (input.type == 'keyDown' && !input.isAutoRepeat && input.code == 'KeyI' && input.alt && input.meta) { + mainWindow.webContents.toggleDevTools(); + } + }, true) } // Make sure that only a single instance of the app is running. @@ -221,22 +229,18 @@ function setAppMenu() { submenu: [ { label: 'Cut', - accelerator: 'CmdOrCtrl+X', role: 'cut' }, { label: 'Copy', - accelerator: 'CmdOrCtrl+C', role: 'copy' }, { label: 'Paste', - accelerator: 'CmdOrCtrl+V', role: 'paste' }, { label: 'Select All', - accelerator: 'CmdOrCtrl+A', role: 'selectall' } ] From 9181455ffdec5e08461689f1549afce80f1d076b Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 25 Apr 2019 10:44:23 +0200 Subject: [PATCH 3/8] MOBILE-2915 desktop: Fix password change opened only once --- .../emulator/classes/inappbrowserobject.ts | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/core/emulator/classes/inappbrowserobject.ts b/src/core/emulator/classes/inappbrowserobject.ts index 95b23898f..1f45c7ba1 100644 --- a/src/core/emulator/classes/inappbrowserobject.ts +++ b/src/core/emulator/classes/inappbrowserobject.ts @@ -224,31 +224,38 @@ export class InAppBrowserObjectMock { } }; - switch (name) { - case 'loadstart': - this.window.webContents.on('did-start-loading', received); + if (!this.window.isDestroyed() && !this.window.webContents.isDestroyed()) { + switch (name) { + case 'loadstart': + this.window.webContents.on('did-start-loading', received); - if (this.isSSO) { - // Linux doesn't support custom URL Schemes. Check if launch page is loaded. - this.window.webContents.on('did-finish-load', finishLoad); - } - break; + if (this.isSSO) { + // Linux doesn't support custom URL Schemes. Check if launch page is loaded. + this.window.webContents.on('did-finish-load', finishLoad); + } + break; - case 'loadstop': - this.window.webContents.on('did-finish-load', received); - break; + case 'loadstop': + this.window.webContents.on('did-finish-load', received); + break; - case 'loaderror': - this.window.webContents.on('did-fail-load', received); - break; - case 'exit': - this.window.on('close', received); - break; - default: + case 'loaderror': + this.window.webContents.on('did-fail-load', received); + break; + case 'exit': + this.window.on('close', received); + break; + default: + } } return (): void => { // Unsubscribing. We need to remove the listeners. + if (this.window.isDestroyed() || this.window.webContents.isDestroyed()) { + // Page has been destroyed already, no need to remove listeners. + return; + } + switch (name) { case 'loadstart': this.window.webContents.removeListener('did-start-loading', received); From ded6099f43c8f5fe739add46114b1f88ff452141 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Tue, 7 May 2019 12:42:23 +0200 Subject: [PATCH 4/8] MOBILE-2999 package: Fix phonegap-plugin-push version --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e89f7b0c..29a9576ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3599,7 +3599,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -5971,7 +5971,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { From 29b959e0f8f721bb9502a73e123267b3700b84fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 7 May 2019 13:38:34 +0200 Subject: [PATCH 5/8] MOBILE-2915 scripts: Package desktop app images --- scripts/linux.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/linux.sh b/scripts/linux.sh index ef76cd0a5..571102f5b 100755 --- a/scripts/linux.sh +++ b/scripts/linux.sh @@ -27,6 +27,10 @@ if [ ! -z $GIT_ORG_PRIVATE ] && [ ! -z $GIT_TOKEN ] ; then mv *i386.AppImage linux-ia32.AppImage mv Moodle*.AppImage linux-x64.AppImage ls + + tar -czvf MoodleDesktop32.tar.gz linux-ia32.AppImage + tar -czvf MoodleDesktop64.tar.gz linux-x64.AppImage + rm *.AppImage git add . git commit -m "Linux desktop versions from Travis build $TRAVIS_BUILD_NUMBER" From 046fc79719e198f05cf84212d19dd9a0f64366d3 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 7 May 2019 15:16:39 +0200 Subject: [PATCH 6/8] MOBILE-2986 desktop: Adapt shortcut to platform for dev tools --- desktop/electron.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/desktop/electron.js b/desktop/electron.js index 5e10f57b7..a526fa466 100644 --- a/desktop/electron.js +++ b/desktop/electron.js @@ -6,6 +6,7 @@ const url = require('url'); const fs = require('fs'); const os = require('os'); const userAgent = 'MoodleMobile'; +const isMac = os.platform().indexOf('darwin') != -1; // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -69,10 +70,10 @@ function createWindow() { // Append some text to the user agent. mainWindow.webContents.setUserAgent(mainWindow.webContents.getUserAgent() + ' ' + userAgent); - // Add shortcut to open dev tools: Control/Cmd + Alt + I. + // Add shortcut to open dev tools: Cmd + Option + I in MacOS, Ctrl + Shift + I in Windows/Linux. mainWindow.webContents.on('before-input-event', function(e, input) { - // The "meta" key is Cmd in MacOS and Control in Windows/Linux. - if (input.type == 'keyDown' && !input.isAutoRepeat && input.code == 'KeyI' && input.alt && input.meta) { + if (input.type == 'keyDown' && !input.isAutoRepeat && input.code == 'KeyI' && + ((isMac && input.alt && input.meta) || (!isMac && input.shift && input.control))) { mainWindow.webContents.toggleDevTools(); } }, true) @@ -83,7 +84,7 @@ function createWindow() { // See https://github.com/electron/electron/issues/15958 var gotTheLock = app.requestSingleInstanceLock(); -if (!gotTheLock && os.platform().indexOf('darwin') == -1) { +if (!gotTheLock && !isMac) { // It's not the main instance of the app, kill it. app.exit(); return; From 90f9980bca285a10d9de830e191681d7457324ba Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 9 May 2019 15:22:07 +0200 Subject: [PATCH 7/8] MOBILE-2915 desktop: Fix resume in desktop --- src/core/emulator/emulator.module.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/emulator/emulator.module.ts b/src/core/emulator/emulator.module.ts index a74809625..fd903e89b 100644 --- a/src/core/emulator/emulator.module.ts +++ b/src/core/emulator/emulator.module.ts @@ -211,7 +211,8 @@ export const IONIC_NATIVE_PROVIDERS = [ ] }) export class CoreEmulatorModule { - constructor(appProvider: CoreAppProvider, initDelegate: CoreInitDelegate, helper: CoreEmulatorHelperProvider) { + constructor(appProvider: CoreAppProvider, initDelegate: CoreInitDelegate, helper: CoreEmulatorHelperProvider, + platform: Platform) { const win = window; // Convert the "window" to "any" type to be able to use non-standard properties. // Emulate Custom URL Scheme plugin in desktop apps. @@ -224,7 +225,7 @@ export class CoreEmulatorModule { // Listen for 'resume' events. require('electron').ipcRenderer.on('coreAppFocused', () => { - document.dispatchEvent(new Event('resume')); + platform.resume.emit(); }); } From ae12465815bdf5eacaa84fde8b1af0aa0002b7f7 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 16 May 2019 10:00:39 +0200 Subject: [PATCH 8/8] MOBILE-2977 core: Fix npm vulnerabilities --- package-lock.json | 50 ++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 29a9576ab..ceda881f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1387,7 +1387,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -3599,7 +3598,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -4081,10 +4080,9 @@ } }, "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esrecurse": { "version": "4.2.1", @@ -5252,9 +5250,9 @@ } }, "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -5971,7 +5969,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -6671,10 +6669,9 @@ "dev": true }, "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -9960,8 +9957,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { "version": "1.14.2", @@ -10178,14 +10174,28 @@ "dev": true }, "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", "dev": true, "requires": { "block-stream": "*", - "fstream": "^1.0.2", + "fstream": "^1.0.12", "inherits": "2" + }, + "dependencies": { + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + } } }, "temp-file": {