Merge pull request #2840 from NoelDeMartin/MOBILE-3320

MOBILE-3320: Fix inappbrowser & regex matcher
main
Dani Palou 2021-06-18 08:39:57 +02:00 committed by GitHub
commit ff61a0ff56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 103 additions and 10 deletions

View File

@ -43,6 +43,7 @@
<preference name="android-minSdkVersion" value="22" />
<preference name="android-targetSdkVersion" value="30" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="AndroidInsecureFileModeEnabled" value="true" />
<preference name="CustomURLSchemePluginClearsAndroidIntent" value="true" />
<preference name="iosPersistentFileLocation" value="Compatibility" />
<preference name="iosScheme" value="moodleappfs" />

92
package-lock.json generated
View File

@ -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",
@ -8071,9 +8077,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",
@ -10457,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",
@ -15864,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",
@ -17222,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",
@ -23969,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",

View File

@ -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",
@ -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"

View File

@ -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']);

View File

@ -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 };
};
}