From cf34846b6a33226561273ca86845e1173f59fddf Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 17 Jun 2021 16:33:51 +0200 Subject: [PATCH 1/3] MOBILE-3320 inappbrowser: Fix opening local files --- config.xml | 1 + package-lock.json | 5 ++--- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config.xml b/config.xml index 8e0c06719..e83aba0ea 100644 --- a/config.xml +++ b/config.xml @@ -43,6 +43,7 @@ + diff --git a/package-lock.json b/package-lock.json index 36e7ce61f..66fa97f76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8071,9 +8071,8 @@ "integrity": "sha1-6sMVgQAphJOvowvolA5pj2HvvP4=" }, "cordova-plugin-inappbrowser": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cordova-plugin-inappbrowser/-/cordova-plugin-inappbrowser-5.0.0.tgz", - "integrity": "sha512-MqnpmUQ/iy6hxtIGDdlIhy8aNi1pNanLATpbnkk7uCqW9YQ4rH/dGK9zESbZ50pUi2A2D2QMjBXNV175TJK5OQ==" + "version": "git+https://github.com/moodlemobile/cordova-plugin-inappbrowser.git#a1ac936fd79596fd5841bd424cc782ee84e4a290", + "from": "git+https://github.com/moodlemobile/cordova-plugin-inappbrowser.git#moodle" }, "cordova-plugin-ionic-keyboard": { "version": "2.2.0", diff --git a/package.json b/package.json index 08c4afd5a..6fcb83309 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "cordova-plugin-file-transfer": "git+https://github.com/moodlemobile/cordova-plugin-file-transfer.git", "cordova-plugin-geolocation": "4.1.0", "cordova-plugin-globalization": "1.11.0", - "cordova-plugin-inappbrowser": "5.0.0", + "cordova-plugin-inappbrowser": "git+https://github.com/moodlemobile/cordova-plugin-inappbrowser.git#moodle", "cordova-plugin-ionic-keyboard": "2.2.0", "cordova-plugin-ionic-webview": "5.0.0", "cordova-plugin-local-notification": "git+https://github.com/moodlemobile/cordova-plugin-local-notification.git#moodle", From ae74cdb91f22d74db826361167e41c1cbd03d325 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 17 Jun 2021 16:35:29 +0200 Subject: [PATCH 2/3] MOBILE-3320 android: Install build dependency --- package-lock.json | 87 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 88 insertions(+) diff --git a/package-lock.json b/package-lock.json index 66fa97f76..122168ca7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6147,6 +6147,12 @@ "isarray": "^1.0.0" } }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, "buffer-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-1.0.0.tgz", @@ -10456,6 +10462,15 @@ "bser": "2.1.1" } }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "figgy-pudding": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", @@ -15863,6 +15878,62 @@ "dev": true, "optional": true }, + "native-run": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/native-run/-/native-run-1.4.0.tgz", + "integrity": "sha512-3XJiDxGNi6XCsn8KYDQFSYGDVkKEMg0y55qTMU0feEuPNNU4iztBwW5bE87sfybZsQPsYDJQyYt9CUKDSoJgdQ==", + "dev": true, + "requires": { + "@ionic/utils-fs": "^3.0.0", + "@ionic/utils-terminal": "^2.3.1", + "bplist-parser": "0.2.0", + "debug": "^4.1.1", + "elementtree": "^0.1.7", + "ini": "^1.3.5", + "plist": "^3.0.1", + "split2": "^3.1.0", + "through2": "^4.0.2", + "tslib": "^2.0.1", + "yauzl": "^2.10.0" + }, + "dependencies": { + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "through2": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", + "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", + "dev": true, + "requires": { + "readable-stream": "3" + } + } + } + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -17221,6 +17292,12 @@ "sha.js": "^2.4.8" } }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -23968,6 +24045,16 @@ "decamelize": "^1.2.0" } }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index 6fcb83309..2bd9413d3 100644 --- a/package.json +++ b/package.json @@ -169,6 +169,7 @@ "jest": "26.5.2", "jest-preset-angular": "8.3.1", "jsonc-parser": "2.3.1", + "native-run": "^1.4.0", "ts-jest": "26.4.1", "ts-node": "8.3.0", "typescript": "3.9.9" From 81876ca5186ce7f4e74ca9cfbf59e8bb49cc6958 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 17 Jun 2021 17:23:36 +0200 Subject: [PATCH 3/3] MOBILE-3320 course: Fix regex patch matcher --- src/app/{tests => }/app-routing.module.test.ts | 3 ++- src/app/app-routing.module.ts | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) rename src/app/{tests => }/app-routing.module.test.ts (94%) diff --git a/src/app/tests/app-routing.module.test.ts b/src/app/app-routing.module.test.ts similarity index 94% rename from src/app/tests/app-routing.module.test.ts rename to src/app/app-routing.module.test.ts index 843ccb3a5..fc06216b9 100644 --- a/src/app/tests/app-routing.module.test.ts +++ b/src/app/app-routing.module.test.ts @@ -17,7 +17,7 @@ import { UrlSegment, UrlSegmentGroup } from '@angular/router'; import { mock } from '@/testing/utils'; -import { buildRegExpUrlMatcher } from '../app-routing.module'; +import { buildRegExpUrlMatcher } from './app-routing.module'; describe('Routing utils', () => { @@ -35,6 +35,7 @@ describe('Routing utils', () => { ); testMatcher('baz/foo/bar', null); + testMatcher('foobar', null); testMatcher('foo', ['foo']); testMatcher('foo/baz', ['foo']); testMatcher('foo/bar/bar/baz', ['foo', 'bar', 'bar']); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4d833851f..3704e74c3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -113,14 +113,18 @@ export function buildRegExpUrlMatcher(regexp: RegExp): UrlMatcher { } // Consume segments that match. - const [consumed] = segments.slice(1).reduce(([consumed, path], segment) => path === match - ? [consumed, path] - :[ - consumed.concat(segment), + const [consumedSegments, consumedPath] = segments.slice(1).reduce(([segments, path], segment) => path === match + ? [segments, path] + : [ + segments.concat(segment), `${path}/${segment.path}`, ], [[segments[0]] as UrlSegment[], segments[0].path]); - return { consumed }; + if (consumedPath !== match) { + return null; + } + + return { consumed: consumedSegments }; }; }