TagSpaces is an offline, open source, document manager with tagging support
Android issues v.2 (#1465)
Stanimirdba6824bae1a
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsxindex a8292a1fe..c17898bd6 100644--- a/app/components/menus/DirectoryMenu.tsx+++ b/app/components/menus/DirectoryMenu.tsx@@ -525,7 +525,8 @@ Do you want to continue?`));}- if (!AppConfig.isCordovaAndroid) {+ if (AppConfig.isCordova) {+ // .isCordovaAndroid) {menuItems.push(<MenuItemkey="takePicture"diff --git a/app/services/cordova-io.ts b/app/services/cordova-io.tsindex 42b5182e5..d4e5fd737 100644--- a/app/services/cordova-io.ts+++ b/app/services/cordova-io.ts@@ -23,7 +23,8 @@ import {extractParentDirectoryPath,cleanTrailingDirSeparator,extractFileName,- extractFileExtension+ extractFileExtension,+ getMetaFileLocationForDir} from '-/utils/paths';import { TS } from '-/tagspaces.namespace';@@ -203,36 +204,36 @@ export default class CordovaIO {} */};- getFileSystemPromise = (localPath: string): Promise<any> => {- console.log('getFileSystemPromise: ' + localPath);+ getDirSystemPromise = (dirPath: string): Promise<any> => {+ console.log('getDirSystemPromise: ' + dirPath);if (- localPath &&- (localPath.indexOf(cordova.file.applicationDirectory) === 0 ||- localPath.startsWith('file:///'))+ dirPath &&+ (dirPath.indexOf(cordova.file.applicationDirectory) === 0 ||+ dirPath.startsWith('file:///'))) {- } else {- localPath = AppConfig.isCordovaiOS- ? (cordova.file.documentsDirectory + '/' + localPath).replace(- ':/',- ':///'- )- : 'file:///' + localPath;+ } else if (AppConfig.isCordovaiOS) {+ dirPath = (cordova.file.documentsDirectory + '/' + dirPath).replace(+ ':/',+ ':///'+ );/*localPath = AppConfig.isCordovaiOS? path.join(cordova.file.documentsDirectory, localPath).replace(':/', ':///'): 'file:///' + localPath;*/+ } else {+ dirPath = (dirPath.startsWith('/') ? 'file://' : 'file:///') + dirPath;}- localPath = encodeURI(localPath);+ dirPath = encodeURI(dirPath) + (dirPath.endsWith('/') ? '' : '/');return new Promise((resolve, reject) => {- window.resolveLocalFileSystemURL(localPath, resolve, error => {+ window.resolveLocalFileSystemURL(dirPath, resolve, error => {console.error('Error getting FileSystem' +- localPath ++ dirPath +': ' +this.cordovaFileError[error.code]); //JSON.stringify(error));- reject(error);+ resolve(false); // reject(error);});});};@@ -252,10 +253,9 @@ export default class CordovaIO {};getAppStorageFileSystem = (fileName: string, fileCallback, fail) => {- const dataFolderPath =- AppConfig.isCordovaiOS === true- ? cordova.file.dataDirectory- : cordova.file.externalApplicationStorageDirectory;+ const dataFolderPath = AppConfig.isCordovaiOS+ ? cordova.file.dataDirectory+ : cordova.file.externalApplicationStorageDirectory;window.resolveLocalFileSystemURL(dataFolderPath,@@ -270,10 +270,9 @@ export default class CordovaIO {getFileSystem = () => {// on android cordova.file.externalRootDirectory points to sdcard0- const fsURL =- AppConfig.isCordovaiOS === true- ? cordova.file.documentsDirectory- : 'file:///';+ const fsURL = AppConfig.isCordovaiOS+ ? cordova.file.documentsDirectory+ : 'file:///';window.resolveLocalFileSystemURL(fsURL,fileSystem => {@@ -472,7 +471,7 @@ export default class CordovaIO {AppConfig.metaFolder +AppConfig.dirSeparator;- this.getFileSystemPromise(metaDirPath)+ this.getDirSystemPromise(metaDirPath).then(fileSystem => {const reader = fileSystem.createReader();reader.readEntries(entr => {@@ -513,7 +512,7 @@ export default class CordovaIO {const enhancedEntries = [];const metaPromises = [];- this.getFileSystemPromise(path)+ this.getDirSystemPromise(path).then(fileSystem => {const reader = fileSystem.createReader();@@ -543,12 +542,17 @@ export default class CordovaIO {if (!lite) {if (entry.isDirectory) {// Read tsm.json from subfolders- const metaDirAvailable: any = metaContent.find(- (obj: any) => obj.name === AppConfig.metaFolder- );- if (metaDirAvailable && metaDirAvailable.path) {+ if (+ !eentry.path.includes(+ AppConfig.dirSeparator + AppConfig.metaFolder+ )+ ) {+ const folderMetaPath = getMetaFileLocationForDir(+ eentry.path,+ AppConfig.dirSeparator+ );metaPromises.push(- this.getEntryMeta(eentry, metaDirAvailable.path)+ this.getEntryMeta(eentry, folderMetaPath));}} else {@@ -744,11 +748,15 @@ export default class CordovaIO {}},err => {- console.log("getPropertiesPromise: It's not file " + entryPath, err);- this.getFileSystemPromise(entryPath).then(dirEntry => {+ this.getDirSystemPromise(entryPath).then(dirEntry => {if (!dirEntry) {resolve(false);+ return false;}+ console.log(+ "getPropertiesPromise: It's not file " + entryPath,+ err+ );resolve({path: dirEntry.fullPath,isFile: dirEntry.isFile,@@ -798,7 +806,7 @@ export default class CordovaIO {return new Promise((resolve, reject) => {if (resolvePath) {- this.getFileSystemPromise(resolvePath)+ this.getDirSystemPromise(resolvePath).then(resfs => {resfs.getFile(filePath,@@ -1153,7 +1161,9 @@ export default class CordovaIO {checkDirExist = dirPath =>new Promise(resolve => {window.resolveLocalFileSystemURL(- (dirPath.startsWith('/') ? 'file://' : 'file:///') + dirPath,+ (dirPath.startsWith('/') ? 'file://' : 'file:///') ++ dirPath ++ (dirPath.endsWith('/') ? '' : '/'),() => {resolve(true);},diff --git a/cordova/package-lock.json b/cordova/package-lock.jsonnew file mode 100644index 000000000..be6fabecb--- /dev/null+++ b/cordova/package-lock.json@@ -0,0 +1,990 @@+{+ "name": "org.tagspaces.iosn",+ "version": "1.0.4",+ "lockfileVersion": 1,+ "requires": true,+ "dependencies": {+ "@globules-io/cordova-plugin-ios-xhr": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/@globules-io/cordova-plugin-ios-xhr/-/cordova-plugin-ios-xhr-1.2.1.tgz",+ "integrity": "sha512-UJTK5Z+gV58V7UzvptDObTtYubHtN1/w+X6Jsh87BUrtbBSWQF3mdDWWBPGlRtOlyZa3Q79II/Xf5a2yJ4e5iQ==",+ "dev": true+ },+ "@netflix/nerror": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/@netflix/nerror/-/nerror-1.1.3.tgz",+ "integrity": "sha512-b+MGNyP9/LXkapreJzNUzcvuzZslj/RGgdVVJ16P2wSlYatfLycPObImqVJSmNAdyeShvNeM/pl3sVZsObFueg==",+ "dev": true,+ "requires": {+ "assert-plus": "1.0.0",+ "extsprintf": "1.4.0",+ "lodash": "4.17.21"+ }+ },+ "@nodelib/fs.scandir": {+ "version": "2.1.5",+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",+ "dev": true,+ "requires": {+ "@nodelib/fs.stat": "2.0.5",+ "run-parallel": "1.2.0"+ }+ },+ "@nodelib/fs.stat": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",+ "dev": true+ },+ "@nodelib/fs.walk": {+ "version": "1.2.7",+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.7.tgz",+ "integrity": "sha512-BTIhocbPBSrRmHxOAJFtR18oLhxTtAFDAvL8hY1S3iU8k+E60W/YFs4jrixGzQjMpF4qPXxIQHcjVD9dz1C2QA==",+ "dev": true,+ "requires": {+ "@nodelib/fs.scandir": "2.1.5",+ "fastq": "1.11.0"+ }+ },+ "abbrev": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",+ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",+ "dev": true+ },+ "android-versions": {+ "version": "1.7.0",+ "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.7.0.tgz",+ "integrity": "sha512-TCy4b8Dk8YS6A23ZPfhSKqK66JHFq0D8avGYiwvYpjno6HrrcI0DRgHx9+jtkvWYmrsE2vQWgbHJhvGGhhOb0g==",+ "dev": true,+ "requires": {+ "semver": "5.7.1"+ },+ "dependencies": {+ "semver": {+ "version": "5.7.1",+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",+ "dev": true+ }+ }+ },+ "ansi": {+ "version": "0.3.1",+ "resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz",+ "integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=",+ "dev": true+ },+ "assert-plus": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",+ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",+ "dev": true+ },+ "at-least-node": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",+ "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==",+ "dev": true+ },+ "balanced-match": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="+ },+ "bamboo.cordova.plugin.downloader": {+ "version": "git+https://github.com/sytolk/cordova-plugin-downloader.git#f4d59a2957a6e1b549634f5e3ba8c7d4898c1396",+ "dev": true+ },+ "base64-js": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",+ "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="+ },+ "big-integer": {+ "version": "1.6.48",+ "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.48.tgz",+ "integrity": "sha512-j51egjPa7/i+RdiRuJbPdJ2FIUYYPhvYLjzoYbcMMm62ooO6F94fETG4MTs46zPAF9Brs04OajboA/qTGuz78w=="+ },+ "bplist-creator": {+ "version": "0.0.8",+ "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz",+ "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==",+ "requires": {+ "stream-buffers": "2.2.0"+ }+ },+ "bplist-parser": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",+ "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==",+ "requires": {+ "big-integer": "1.6.48"+ }+ },+ "brace-expansion": {+ "version": "1.1.11",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",+ "requires": {+ "balanced-match": "1.0.2",+ "concat-map": "0.0.1"+ }+ },+ "braces": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",+ "dev": true,+ "requires": {+ "fill-range": "7.0.1"+ }+ },+ "com-darryncampbell-cordova-plugin-intent": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/com-darryncampbell-cordova-plugin-intent/-/com-darryncampbell-cordova-plugin-intent-2.0.0.tgz",+ "integrity": "sha512-4f5BAyhpiGVsuouj2cokZCb99RA8V4O5YZnwGMliceFCu35BQcQvC0VLW55jl+xVDLhVymomnaBiHSktKKnK4w==",+ "dev": true+ },+ "concat-map": {+ "version": "0.0.1",+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="+ },+ "cordova-android": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-9.1.0.tgz",+ "integrity": "sha512-bzOX9E4eQsOSpa06oZZ7XAGq3DwB73juhhj0oPqHH/khWk0mkCD4aiVYMFoc0fmIaSQvzbY1ww7L6UBW5pyGfg==",+ "dev": true,+ "requires": {+ "android-versions": "1.7.0",+ "cordova-common": "4.0.2",+ "execa": "4.1.0",+ "fast-glob": "3.2.6",+ "fs-extra": "9.1.0",+ "is-path-inside": "3.0.3",+ "nopt": "4.0.3",+ "properties-parser": "0.3.1",+ "semver": "7.3.5",+ "which": "2.0.2"+ },+ "dependencies": {+ "semver": {+ "version": "7.3.5",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",+ "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",+ "dev": true,+ "requires": {+ "lru-cache": "6.0.0"+ }+ }+ }+ },+ "cordova-common": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-4.0.2.tgz",+ "integrity": "sha512-od7aNShyuBajzPY83mUEO8tERwwWdFklXETHiXP5Ft87CWeo/tSuwNPFztyTy8XYc74yXdogXKPTJeUHuVzB8Q==",+ "dev": true,+ "requires": {+ "@netflix/nerror": "1.1.3",+ "ansi": "0.3.1",+ "bplist-parser": "0.2.0",+ "cross-spawn": "7.0.3",+ "elementtree": "0.1.7",+ "endent": "1.4.1",+ "fast-glob": "3.2.6",+ "fs-extra": "9.1.0",+ "glob": "7.1.7",+ "plist": "3.0.2",+ "q": "1.5.1",+ "read-chunk": "3.2.0",+ "strip-bom": "4.0.0",+ "underscore": "1.13.1"+ }+ },+ "cordova-ios": {+ "version": "6.2.0",+ "resolved": "https://registry.npmjs.org/cordova-ios/-/cordova-ios-6.2.0.tgz",+ "integrity": "sha512-sLjZg2QBI1SpQVwfe0MSn89YNVkBGLW9Q1vcFJBsqKBrhvoEOJ5Ytq0gwqdhgTOGzlwJUfxC6OHM3jcsRjtYrw==",+ "dev": true,+ "requires": {+ "cordova-common": "4.0.2",+ "fs-extra": "9.1.0",+ "ios-sim": "8.0.2",+ "nopt": "5.0.0",+ "plist": "3.0.2",+ "semver": "7.3.5",+ "unorm": "1.6.0",+ "which": "2.0.2",+ "xcode": "3.0.1",+ "xml-escape": "1.1.0"+ },+ "dependencies": {+ "nopt": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",+ "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",+ "dev": true,+ "requires": {+ "abbrev": "1.1.1"+ }+ },+ "semver": {+ "version": "7.3.5",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",+ "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",+ "dev": true,+ "requires": {+ "lru-cache": "6.0.0"+ }+ },+ "uuid": {+ "version": "7.0.3",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz",+ "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==",+ "dev": true+ },+ "xcode": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/xcode/-/xcode-3.0.1.tgz",+ "integrity": "sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA==",+ "dev": true,+ "requires": {+ "simple-plist": "1.1.1",+ "uuid": "7.0.3"+ }+ }+ }+ },+ "cordova-ourcodeworld-filebrowser": {+ "version": "git+https://github.com/muhammed-noufal/cordova-ourcodeworld-filebrowser.git#07b8d2298a53691913101da5f704cb11159aed70",+ "dev": true+ },+ "cordova-plugin-add-swift-support": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/cordova-plugin-add-swift-support/-/cordova-plugin-add-swift-support-2.0.2.tgz",+ "integrity": "sha512-K03WDnsD3GT+n7Od3BnS17D8rYnAFZbZjjQJa2r7qW8QLq8+h7hGbFaiF+w5+nUtyAqUNq+HT/d/MdqBGLNzxA==",+ "requires": {+ "glob": "7.1.7",+ "semver": "6.3.0",+ "xcode": "2.1.0"+ }+ },+ "cordova-plugin-androidx": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/cordova-plugin-androidx/-/cordova-plugin-androidx-3.0.0.tgz",+ "integrity": "sha512-niMnhcxKsu4/oKTUbL0jRAnh6/cdoIVxRxJqj3uEyv8CVOlAj1sWhX+9b1XiAo9+bejAM9BbA21YK0mChfbVTA==",+ "dev": true+ },+ "cordova-plugin-androidx-adapter": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/cordova-plugin-androidx-adapter/-/cordova-plugin-androidx-adapter-1.1.3.tgz",+ "integrity": "sha512-W1SImn0cCCvOSTSfWWp5TnanIQrSuh2Bch+dcZXIzEn0km3Qb7VryeAqHhgBQYwwzC5Ollk1DtUAk/AJSojuZA==",+ "dev": true,+ "requires": {+ "q": "1.5.1",+ "recursive-readdir": "2.2.2"+ }+ },+ "cordova-plugin-background-mode": {+ "version": "0.7.3",+ "resolved": "https://registry.npmjs.org/cordova-plugin-background-mode/-/cordova-plugin-background-mode-0.7.3.tgz",+ "integrity": "sha512-LsU1v7EgTUROaks+tcQ8TnMzVUcU/TwjDVwj2O/4e4aI2q2ldLGsiZorqKqfqvwh2HoIssmY73OwJk91hQi62w=="+ },+ "cordova-plugin-camera": {+ "version": "5.0.2",+ "resolved": "https://registry.npmjs.org/cordova-plugin-camera/-/cordova-plugin-camera-5.0.2.tgz",+ "integrity": "sha512-iR9W9S+USg/YTjwB+6rnIqJ1mZ02da0Q2VDU0Twf/CccEJO+006T5RM/NYDkBRs6vMCw7rWXroCNJOPBLLETPQ==",+ "dev": true+ },+ "cordova-plugin-device": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.3.tgz",+ "integrity": "sha512-Jb3V72btxf3XHpkPQsGdyc8N6tVBYn1vsxSFj43fIz9vonJDUThYPCJJHqk6PX6N4dJw6I4FjxkpfCR4LDYMlw=="+ },+ "cordova-plugin-file": {+ "version": "git+https://github.com/apache/cordova-plugin-file.git#f3b3b503a2a15d6c7025898950c9699cd6e79ca0",+ "dev": true+ },+ "cordova-plugin-file-opener2": {+ "version": "3.0.5",+ "resolved": "https://registry.npmjs.org/cordova-plugin-file-opener2/-/cordova-plugin-file-opener2-3.0.5.tgz",+ "integrity": "sha512-tjLHDamH5+y0bJZYVe2967L1S4R8tL4Y0rJUzJGoxsyiw3FUlrJNS199POOpzZZ6Xhlntn9a2o7+84r1dMN21A=="+ },+ "cordova-plugin-whitelist": {+ "version": "1.3.5",+ "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",+ "integrity": "sha512-+v/VzCYBdGsIxJTP2m+RWaq7l/NLu7b976w6XGJUFiN2TVOeaGrytaR4jRy0w9akRai8uKFeBmuGHmlS/sOeCA=="+ },+ "cordova-plugin-x-socialsharing": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/cordova-plugin-x-socialsharing/-/cordova-plugin-x-socialsharing-6.0.3.tgz",+ "integrity": "sha512-pnrE2CXsz4G0n0WoFDAasLS1VT3nIsNpddvXgfpiqX3wyOlSjO2NdF+sjYaTvs1B+f7z8EWbYCHpCrgBQiMLIg==",+ "dev": true+ },+ "cross-spawn": {+ "version": "7.0.3",+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",+ "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",+ "dev": true,+ "requires": {+ "path-key": "3.1.1",+ "shebang-command": "2.0.0",+ "which": "2.0.2"+ }+ },+ "dedent": {+ "version": "0.7.0",+ "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz",+ "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=",+ "dev": true+ },+ "elementtree": {+ "version": "0.1.7",+ "resolved": "https://registry.npmjs.org/elementtree/-/elementtree-0.1.7.tgz",+ "integrity": "sha1-mskb5uUvtuYkTE5UpKw+2K6OKcA=",+ "dev": true,+ "requires": {+ "sax": "1.1.4"+ }+ },+ "end-of-stream": {+ "version": "1.4.4",+ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",+ "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",+ "dev": true,+ "requires": {+ "once": "1.4.0"+ }+ },+ "endent": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/endent/-/endent-1.4.1.tgz",+ "integrity": "sha512-buHTb5c8AC9NshtP6dgmNLYkiT+olskbq1z6cEGvfGCF3Qphbu/1zz5Xu+yjTDln8RbxNhPoUyJ5H8MSrp1olQ==",+ "dev": true,+ "requires": {+ "dedent": "0.7.0",+ "fast-json-parse": "1.0.3",+ "objectorarray": "1.0.5"+ }+ },+ "es6-promise-plugin": {+ "version": "4.2.2",+ "resolved": "https://registry.npmjs.org/es6-promise-plugin/-/es6-promise-plugin-4.2.2.tgz",+ "integrity": "sha512-uoA4aVplXI9oqUYJFBAVRwAqIN9/n9JgrTAUGX3qPbnSZVE5yY1+6/MsoN5f4xsaPO62WjPHOdtts6okMN6tNA=="+ },+ "execa": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz",+ "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==",+ "dev": true,+ "requires": {+ "cross-spawn": "7.0.3",+ "get-stream": "5.2.0",+ "human-signals": "1.1.1",+ "is-stream": "2.0.0",+ "merge-stream": "2.0.0",+ "npm-run-path": "4.0.1",+ "onetime": "5.1.2",+ "signal-exit": "3.0.3",+ "strip-final-newline": "2.0.0"+ }+ },+ "extsprintf": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.0.tgz",+ "integrity": "sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=",+ "dev": true+ },+ "fast-glob": {+ "version": "3.2.6",+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.6.tgz",+ "integrity": "sha512-GnLuqj/pvQ7pX8/L4J84nijv6sAnlwvSDpMkJi9i7nPmPxGtRPkBSStfvDW5l6nMdX9VWe+pkKWFTgD+vF2QSQ==",+ "dev": true,+ "requires": {+ "@nodelib/fs.stat": "2.0.5",+ "@nodelib/fs.walk": "1.2.7",+ "glob-parent": "5.1.2",+ "merge2": "1.4.1",+ "micromatch": "4.0.4"+ }+ },+ "fast-json-parse": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/fast-json-parse/-/fast-json-parse-1.0.3.tgz",+ "integrity": "sha512-FRWsaZRWEJ1ESVNbDWmsAlqDk96gPQezzLghafp5J4GUKjbCz3OkAHuZs5TuPEtkbVQERysLp9xv6c24fBm8Aw==",+ "dev": true+ },+ "fastq": {+ "version": "1.11.0",+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz",+ "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==",+ "dev": true,+ "requires": {+ "reusify": "1.0.4"+ }+ },+ "fill-range": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",+ "dev": true,+ "requires": {+ "to-regex-range": "5.0.1"+ }+ },+ "fs-extra": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz",+ "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",+ "dev": true,+ "requires": {+ "at-least-node": "1.0.0",+ "graceful-fs": "4.2.6",+ "jsonfile": "6.1.0",+ "universalify": "2.0.0"+ }+ },+ "fs.realpath": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="+ },+ "get-stream": {+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",+ "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",+ "dev": true,+ "requires": {+ "pump": "3.0.0"+ }+ },+ "glob": {+ "version": "7.1.7",+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",+ "requires": {+ "fs.realpath": "1.0.0",+ "inflight": "1.0.6",+ "inherits": "2.0.4",+ "minimatch": "3.0.4",+ "once": "1.4.0",+ "path-is-absolute": "1.0.1"+ }+ },+ "glob-parent": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",+ "dev": true,+ "requires": {+ "is-glob": "4.0.1"+ }+ },+ "graceful-fs": {+ "version": "4.2.6",+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",+ "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",+ "dev": true+ },+ "human-signals": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",+ "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==",+ "dev": true+ },+ "inflight": {+ "version": "1.0.6",+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",+ "requires": {+ "once": "1.4.0",+ "wrappy": "1.0.2"+ }+ },+ "inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="+ },+ "ios-sim": {+ "version": "8.0.2",+ "resolved": "https://registry.npmjs.org/ios-sim/-/ios-sim-8.0.2.tgz",+ "integrity": "sha512-P7nEG771bfd+JoMRjnis1gpZOkjTUUxu+4Ek1Z+eoaEEoT9byllU9pxfQ8Df7hL3gSkIQxNwTSLhos2I8tWUQA==",+ "dev": true,+ "requires": {+ "bplist-parser": "0.0.6",+ "nopt": "1.0.9",+ "plist": "3.0.2",+ "simctl": "2.0.0"+ },+ "dependencies": {+ "bplist-parser": {+ "version": "0.0.6",+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",+ "integrity": "sha1-ONo0cYF9+dRKs4kuJ3B7u9daEbk=",+ "dev": true+ },+ "nopt": {+ "version": "1.0.9",+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.9.tgz",+ "integrity": "sha1-O8DXy6e/sNWmdtvtfA6+SKT9RU4=",+ "dev": true,+ "requires": {+ "abbrev": "1.1.1"+ }+ }+ }+ },+ "is-extglob": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",+ "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=",+ "dev": true+ },+ "is-glob": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",+ "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",+ "dev": true,+ "requires": {+ "is-extglob": "2.1.1"+ }+ },+ "is-number": {+ "version": "7.0.0",+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",+ "dev": true+ },+ "is-path-inside": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",+ "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",+ "dev": true+ },+ "is-stream": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",+ "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==",+ "dev": true+ },+ "isexe": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",+ "dev": true+ },+ "jsonfile": {+ "version": "6.1.0",+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",+ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",+ "dev": true,+ "requires": {+ "graceful-fs": "4.2.6",+ "universalify": "2.0.0"+ }+ },+ "lodash": {+ "version": "4.17.21",+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",+ "dev": true+ },+ "lru-cache": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",+ "dev": true,+ "requires": {+ "yallist": "4.0.0"+ }+ },+ "merge-stream": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",+ "dev": true+ },+ "merge2": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",+ "dev": true+ },+ "micromatch": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",+ "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",+ "dev": true,+ "requires": {+ "braces": "3.0.2",+ "picomatch": "2.3.0"+ }+ },+ "mimic-fn": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",+ "dev": true+ },+ "minimatch": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",+ "requires": {+ "brace-expansion": "1.1.11"+ }+ },+ "nopt": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",+ "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",+ "dev": true,+ "requires": {+ "abbrev": "1.1.1",+ "osenv": "0.1.5"+ }+ },+ "npm-run-path": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",+ "dev": true,+ "requires": {+ "path-key": "3.1.1"+ }+ },+ "objectorarray": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/objectorarray/-/objectorarray-1.0.5.tgz",+ "integrity": "sha512-eJJDYkhJFFbBBAxeh8xW+weHlkI28n2ZdQV/J/DNfWfSKlGEf2xcfAbZTv3riEXHAhL9SVOTs2pRmXiSTf78xg==",+ "dev": true+ },+ "once": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",+ "requires": {+ "wrappy": "1.0.2"+ }+ },+ "onetime": {+ "version": "5.1.2",+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",+ "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",+ "dev": true,+ "requires": {+ "mimic-fn": "2.1.0"+ }+ },+ "os-homedir": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",+ "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",+ "dev": true+ },+ "os-tmpdir": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",+ "dev": true+ },+ "osenv": {+ "version": "0.1.5",+ "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",+ "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",+ "dev": true,+ "requires": {+ "os-homedir": "1.0.2",+ "os-tmpdir": "1.0.2"+ }+ },+ "p-finally": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",+ "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",+ "dev": true+ },+ "p-try": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",+ "dev": true+ },+ "path-is-absolute": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="+ },+ "path-key": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",+ "dev": true+ },+ "picomatch": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",+ "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==",+ "dev": true+ },+ "pify": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",+ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",+ "dev": true+ },+ "plist": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.2.tgz",+ "integrity": "sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ==",+ "requires": {+ "base64-js": "1.5.1",+ "xmlbuilder": "9.0.7",+ "xmldom": "0.5.0"+ }+ },+ "properties-parser": {+ "version": "0.3.1",+ "resolved": "https://registry.npmjs.org/properties-parser/-/properties-parser-0.3.1.tgz",+ "integrity": "sha1-ExbpU5/7/ZOEXjabIRAiq9R4dxo=",+ "dev": true,+ "requires": {+ "string.prototype.codepointat": "0.2.1"+ }+ },+ "pump": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",+ "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",+ "dev": true,+ "requires": {+ "end-of-stream": "1.4.4",+ "once": "1.4.0"+ }+ },+ "q": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",+ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",+ "dev": true+ },+ "queue-microtask": {+ "version": "1.2.3",+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",+ "dev": true+ },+ "read-chunk": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/read-chunk/-/read-chunk-3.2.0.tgz",+ "integrity": "sha512-CEjy9LCzhmD7nUpJ1oVOE6s/hBkejlcJEgLQHVnQznOSilOPb+kpKktlLfFDK3/WP43+F80xkUTM2VOkYoSYvQ==",+ "dev": true,+ "requires": {+ "pify": "4.0.1",+ "with-open-file": "0.1.7"+ }+ },+ "recursive-readdir": {+ "version": "2.2.2",+ "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz",+ "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==",+ "dev": true,+ "requires": {+ "minimatch": "3.0.4"+ }+ },+ "reusify": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",+ "dev": true+ },+ "run-parallel": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",+ "dev": true,+ "requires": {+ "queue-microtask": "1.2.3"+ }+ },+ "sax": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.1.4.tgz",+ "integrity": "sha1-dLbTPJrh4AFRDxeakRaFiPGu2qk=",+ "dev": true+ },+ "semver": {+ "version": "6.3.0",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="+ },+ "shebang-command": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",+ "dev": true,+ "requires": {+ "shebang-regex": "3.0.0"+ }+ },+ "shebang-regex": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",+ "dev": true+ },+ "shelljs": {+ "version": "0.2.6",+ "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz",+ "integrity": "sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=",+ "dev": true+ },+ "signal-exit": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",+ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",+ "dev": true+ },+ "simctl": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.0.tgz",+ "integrity": "sha512-5rB7rN4N3b0z0nFdy9eczVssXqrv2aAgdVRksPVqVoiDtvXmfzNvebp3EMdId2sAUzXIflarQlx4P0hjVQEzKQ==",+ "dev": true,+ "requires": {+ "shelljs": "0.2.6",+ "tail": "0.4.0"+ }+ },+ "simple-plist": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.1.1.tgz",+ "integrity": "sha512-pKMCVKvZbZTsqYR6RKgLfBHkh2cV89GXcA/0CVPje3sOiNOnXA8+rp/ciAMZ7JRaUdLzlEM6JFfUn+fS6Nt3hg==",+ "requires": {+ "bplist-creator": "0.0.8",+ "bplist-parser": "0.2.0",+ "plist": "3.0.2"+ }+ },+ "stream-buffers": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/stream-buffers/-/stream-buffers-2.2.0.tgz",+ "integrity": "sha1-kdX1Ew0c75bc+n9yaUUYh0HQnuQ="+ },+ "string.prototype.codepointat": {+ "version": "0.2.1",+ "resolved": "https://registry.npmjs.org/string.prototype.codepointat/-/string.prototype.codepointat-0.2.1.tgz",+ "integrity": "sha512-2cBVCj6I4IOvEnjgO/hWqXjqBGsY+zwPmHl12Srk9IXSZ56Jwwmy+66XO5Iut/oQVR7t5ihYdLB0GMa4alEUcg==",+ "dev": true+ },+ "strip-bom": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz",+ "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==",+ "dev": true+ },+ "strip-final-newline": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",+ "dev": true+ },+ "tail": {+ "version": "0.4.0",+ "resolved": "https://registry.npmjs.org/tail/-/tail-0.4.0.tgz",+ "integrity": "sha1-0p3nJ1DMmdseBTr/E8NZ7PtxMAI=",+ "dev": true+ },+ "to-regex-range": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",+ "dev": true,+ "requires": {+ "is-number": "7.0.0"+ }+ },+ "underscore": {+ "version": "1.13.1",+ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz",+ "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==",+ "dev": true+ },+ "universalify": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",+ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",+ "dev": true+ },+ "unorm": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz",+ "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==",+ "dev": true+ },+ "uuid": {+ "version": "3.4.0",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="+ },+ "which": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",+ "dev": true,+ "requires": {+ "isexe": "2.0.0"+ }+ },+ "with-open-file": {+ "version": "0.1.7",+ "resolved": "https://registry.npmjs.org/with-open-file/-/with-open-file-0.1.7.tgz",+ "integrity": "sha512-ecJS2/oHtESJ1t3ZfMI3B7KIDKyfN0O16miWxdn30zdh66Yd3LsRFebXZXq6GU4xfxLf6nVxp9kIqElb5fqczA==",+ "dev": true,+ "requires": {+ "p-finally": "1.0.0",+ "p-try": "2.2.0",+ "pify": "4.0.1"+ }+ },+ "wrappy": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="+ },+ "xcode": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/xcode/-/xcode-2.1.0.tgz",+ "integrity": "sha512-uCrmPITrqTEzhn0TtT57fJaNaw8YJs1aCzs+P/QqxsDbvPZSv7XMPPwXrKvHtD6pLjBM/NaVwraWJm8q83Y4iQ==",+ "requires": {+ "simple-plist": "1.1.1",+ "uuid": "3.4.0"+ }+ },+ "xml-escape": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/xml-escape/-/xml-escape-1.1.0.tgz",+ "integrity": "sha1-OQTBQ/qOs6ADDsZG0pAqLxtwbEQ=",+ "dev": true+ },+ "xmlbuilder": {+ "version": "9.0.7",+ "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",+ "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="+ },+ "xmldom": {+ "version": "0.5.0",+ "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz",+ "integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA=="+ },+ "yallist": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",+ "dev": true+ }+ }+}diff --git a/cordova/package.json b/cordova/package.jsonindex 1a9ae16a1..c3033bb4b 100644--- a/cordova/package.json+++ b/cordova/package.json@@ -49,7 +49,7 @@"@globules-io/cordova-plugin-ios-xhr": "^1.0.4","bamboo.cordova.plugin.downloader": "git+https://github.com/sytolk/cordova-plugin-downloader.git","com-darryncampbell-cordova-plugin-intent": "^2.0.0",- "cordova-android": "^9.0.0",+ "cordova-android": "^9.1.0","cordova-ios": "^6.2.0","cordova-ourcodeworld-filebrowser": "git+https://github.com/muhammed-noufal/cordova-ourcodeworld-filebrowser.git","cordova-plugin-androidx": "^3.0.0",@@ -58,4 +58,4 @@"cordova-plugin-file": "git+https://github.com/apache/cordova-plugin-file.git","cordova-plugin-x-socialsharing": "^6.0.3"}-}+}\ No newline at end of filediff --git a/cordova/platforms/android/CordovaLib/build.gradle b/cordova/platforms/android/CordovaLib/build.gradleindex d7e0b1f72..25cca89e6 100644--- a/cordova/platforms/android/CordovaLib/build.gradle+++ b/cordova/platforms/android/CordovaLib/build.gradle@@ -20,13 +20,17 @@ ext {apply from: 'cordova.gradle'cdvCompileSdkVersion = privateHelpers.getProjectTarget()cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()+ if (project.hasProperty('cdvMinSdkVersion') && cdvMinSdkVersion.isInteger()) {+ cdvMinSdkVersion = cdvMinSdkVersion as int+ println '[Cordova] cdvMinSdkVersion is overridden, try it at your own risk.'+ } else {+ cdvMinSdkVersion = 22; // current Cordova's default+ }}buildscript {- repositories {- google()- jcenter()- }+ apply from: 'repositories.gradle'+ repositories reposdependencies {// The gradle plugin and the maven plugin have to be updated after each version of Android@@ -38,10 +42,8 @@ buildscript {}allprojects {- repositories {- google()- jcenter()- }+ apply from: 'repositories.gradle'+ repositories repos}apply plugin: 'com.android.library'@@ -49,7 +51,7 @@ apply plugin: 'com.github.dcendents.android-maven'apply plugin: 'com.jfrog.bintray'group = 'org.apache.cordova'-version = '9.0.0'+version = '9.1.0'android {compileSdkVersion cdvCompileSdkVersion@@ -60,9 +62,9 @@ android {targetCompatibility JavaVersion.VERSION_1_8}- // For the Android Cordova Lib, we will hardcode the minSdkVersion and not allow changes.+ // For the Android Cordova Lib, we allow changing the minSdkVersion, but it is at the users own riskdefaultConfig {- minSdkVersion 22+ minSdkVersion cdvMinSdkVersion}sourceSets {@@ -140,9 +142,9 @@ bintray {licenses = ['Apache-2.0']labels = ['android', 'cordova', 'phonegap']version {- name = '9.0.0'- released = new Date()- vcsTag = '9.0.0'+ name = '9.1.0'+ released = new Date()+ vcsTag = '9.1.0'}}}diff --git a/cordova/platforms/android/CordovaLib/repositories.gradle b/cordova/platforms/android/CordovaLib/repositories.gradlenew file mode 100644index 000000000..1384d1457--- /dev/null+++ b/cordova/platforms/android/CordovaLib/repositories.gradle@@ -0,0 +1,22 @@+/* Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+*/++ext.repos = {+ google()+ jcenter()+}diff --git a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.java b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.javaindex f2f5619e6..9b15e3366 100755--- a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.java+++ b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.java@@ -125,6 +125,9 @@ public class CordovaActivity extends Activity {// (as was the case in previous cordova versions)if (!preferences.getBoolean("FullscreenNotImmersive", false)) {immersiveMode = true;+ // The splashscreen plugin needs the flags set before we're focused to prevent+ // the nav and title bars from flashing in.+ setImmersiveUiVisibility();} else {getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);@@ -321,22 +324,26 @@ public class CordovaActivity extends Activity {/*** Called when view focus is changed*/- @SuppressLint("InlinedApi")@Overridepublic void onWindowFocusChanged(boolean hasFocus) {super.onWindowFocusChanged(hasFocus);if (hasFocus && immersiveMode) {- final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION- | View.SYSTEM_UI_FLAG_FULLSCREEN- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;-- getWindow().getDecorView().setSystemUiVisibility(uiOptions);+ setImmersiveUiVisibility();}}+ @SuppressLint("InlinedApi")+ protected void setImmersiveUiVisibility() {+ final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION+ | View.SYSTEM_UI_FLAG_FULLSCREEN+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;++ getWindow().getDecorView().setSystemUiVisibility(uiOptions);+ }+@SuppressLint("NewApi")@Overridepublic void startActivityForResult(Intent intent, int requestCode, Bundle options) {diff --git a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaBridge.java b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaBridge.javaindex 7416cd193..a8e836923 100644--- a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaBridge.java+++ b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaBridge.java@@ -114,7 +114,6 @@ public class CordovaBridge {/** Called by cordova.js to initialize the bridge. *///On old Androids SecureRandom isn't really secure, this is the least of your problems if//you're running Android 4.3 and below in 2017- @SuppressLint("TrulyRandom")int generateBridgeSecret() {SecureRandom randGen = new SecureRandom();expectedBridgeSecret = randGen.nextInt(Integer.MAX_VALUE);diff --git a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.javaindex 8350ec278..a9f3453c0 100644--- a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java+++ b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java@@ -41,6 +41,7 @@ import java.net.HttpURLConnection;import java.net.URL;import java.nio.channels.FileChannel;import java.util.Locale;+import java.util.zip.GZIPInputStream;/*** What this class provides:@@ -286,13 +287,19 @@ public class CordovaResourceApi {case URI_TYPE_HTTP:case URI_TYPE_HTTPS: {HttpURLConnection conn = (HttpURLConnection)new URL(uri.toString()).openConnection();+ conn.setRequestProperty("Accept-Encoding", "gzip");conn.setDoInput(true);String mimeType = conn.getHeaderField("Content-Type");if (mimeType != null) {mimeType = mimeType.split(";")[0];}int length = conn.getContentLength();- InputStream inputStream = conn.getInputStream();+ InputStream inputStream;+ if ("gzip".equals(conn.getContentEncoding())) {+ inputStream = new GZIPInputStream(conn.getInputStream());+ } else {+ inputStream = conn.getInputStream();+ }return new OpenForReadResult(uri, inputStream, mimeType, length, null);}case URI_TYPE_PLUGIN: {diff --git a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.javaindex 7ee8d2470..96b2c4f7e 100644--- a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java+++ b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java@@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;* are not expected to implement it.*/public interface CordovaWebView {- public static final String CORDOVA_VERSION = "9.0.0";+ public static final String CORDOVA_VERSION = "9.1.0";void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);diff --git a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewImpl.java b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewImpl.javaindex a77502d6e..b0ddcf439 100644--- a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewImpl.java+++ b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewImpl.java@@ -19,6 +19,7 @@package org.apache.cordova;import android.annotation.SuppressLint;+import android.content.ActivityNotFoundException;import android.content.Context;import android.content.Intent;import android.net.Uri;@@ -34,6 +35,7 @@ import org.json.JSONException;import org.json.JSONObject;import java.lang.reflect.Constructor;+import java.net.URISyntaxException;import java.util.ArrayList;import java.util.HashSet;import java.util.List;@@ -176,22 +178,28 @@ public class CordovaWebViewImpl implements CordovaWebView {e.printStackTrace();}- // If timeout, then stop loading and handle error- if (loadUrlTimeout == currentLoadUrlTimeout) {+ // If timeout, then stop loading and handle error (if activity still exists)+ if (loadUrlTimeout == currentLoadUrlTimeout && cordova.getActivity() != null) {cordova.getActivity().runOnUiThread(loadError);+ } else if (cordova.getActivity() == null) {+ LOG.d(TAG, "Cordova activity does not exist.");}}};- final boolean _recreatePlugins = recreatePlugins;- cordova.getActivity().runOnUiThread(new Runnable() {- public void run() {- if (loadUrlTimeoutValue > 0) {- cordova.getThreadPool().execute(timeoutCheck);+ if (cordova.getActivity() != null) {+ final boolean _recreatePlugins = recreatePlugins;+ cordova.getActivity().runOnUiThread(new Runnable() {+ public void run() {+ if (loadUrlTimeoutValue > 0) {+ cordova.getThreadPool().execute(timeoutCheck);+ }+ engine.loadUrl(url, _recreatePlugins);}- engine.loadUrl(url, _recreatePlugins);- }- });+ });+ } else {+ LOG.d(TAG, "Cordova activity does not exist.");+ }}@@ -226,21 +234,37 @@ public class CordovaWebViewImpl implements CordovaWebView {LOG.w(TAG, "showWebPage: Refusing to send intent for URL since it is not in the <allow-intent> whitelist. URL=" + url);return;}++ Intent intent = null;try {- Intent intent = new Intent(Intent.ACTION_VIEW);- // To send an intent without CATEGORY_BROWSER, a custom plugin should be used.- intent.addCategory(Intent.CATEGORY_BROWSABLE);- Uri uri = Uri.parse(url);- // Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".- // Adding the MIME type to http: URLs causes them to not be handled by the downloader.- if ("file".equals(uri.getScheme())) {- intent.setDataAndType(uri, resourceApi.getMimeType(uri));+ if (url.startsWith("intent://")) {+ intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);+ } else {+ intent = new Intent(Intent.ACTION_VIEW);+ // To send an intent without CATEGORY_BROWSER, a custom plugin should be used.+ intent.addCategory(Intent.CATEGORY_BROWSABLE);+ Uri uri = Uri.parse(url);+ // Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".+ // Adding the MIME type to http: URLs causes them to not be handled by the downloader.+ if ("file".equals(uri.getScheme())) {+ intent.setDataAndType(uri, resourceApi.getMimeType(uri));+ } else {+ intent.setData(uri);+ }+ }+ if (cordova.getActivity() != null) {+ cordova.getActivity().startActivity(intent);} else {- intent.setData(uri);+ LOG.d(TAG, "Cordova activity does not exist.");+ }+ } catch (URISyntaxException e) {+ LOG.e(TAG, "Error parsing url " + url, e);+ } catch (ActivityNotFoundException e) {+ if (url.startsWith("intent://") && intent != null && intent.getStringExtra("browser_fallback_url") != null) {+ showWebPage(intent.getStringExtra("browser_fallback_url"), openExternal, clearHistory, params);+ } else {+ LOG.e(TAG, "Error loading url " + url, e);}- cordova.getActivity().startActivity(intent);- } catch (android.content.ActivityNotFoundException e) {- LOG.e(TAG, "Error loading url " + url, e);}}@@ -255,7 +279,12 @@ public class CordovaWebViewImpl implements CordovaWebView {@Overridepublic boolean dispatchKeyEvent(KeyEvent event) {- return engine.getView().dispatchKeyEvent(event);+ boolean ret = engine.getView().dispatchKeyEvent(event);+ if (!ret) {+ // If the engine didn't handle the event, handle it normally.+ ret = super.dispatchKeyEvent(event);+ }+ return ret;}}@@ -553,11 +582,15 @@ public class CordovaWebViewImpl implements CordovaWebView {public void run() {try {Thread.sleep(2000);- cordova.getActivity().runOnUiThread(new Runnable() {- public void run() {- pluginManager.postMessage("spinner", "stop");- }- });+ if (cordova.getActivity() != null) {+ cordova.getActivity().runOnUiThread(new Runnable() {+ public void run() {+ pluginManager.postMessage("spinner", "stop");+ }+ });+ } else {+ LOG.d(TAG, "Cordova activity does not exist.");+ }} catch (InterruptedException e) {}}diff --git a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/PluginManager.java b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/PluginManager.javaindex c9576a6c3..21aec73ef 100755--- a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/PluginManager.java+++ b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/PluginManager.java@@ -19,7 +19,9 @@package org.apache.cordova;import java.util.Collection;+import java.util.Collections;import java.util.LinkedHashMap;+import java.util.Map;import org.json.JSONException;@@ -28,6 +30,7 @@ import android.content.res.Configuration;import android.net.Uri;import android.os.Bundle;import android.os.Debug;+import android.os.Build;/*** PluginManager is exposed to JavaScript in the Cordova WebView.@@ -40,8 +43,8 @@ public class PluginManager {private static final int SLOW_EXEC_WARNING_THRESHOLD = Debug.isDebuggerConnected() ? 60 : 16;// List of service entries- private final LinkedHashMap<String, CordovaPlugin> pluginMap = new LinkedHashMap<String, CordovaPlugin>();- private final LinkedHashMap<String, PluginEntry> entryMap = new LinkedHashMap<String, PluginEntry>();+ private final Map<String, CordovaPlugin> pluginMap = Collections.synchronizedMap(new LinkedHashMap<String, CordovaPlugin>());+ private final Map<String, PluginEntry> entryMap = Collections.synchronizedMap(new LinkedHashMap<String, PluginEntry>());private final CordovaInterface ctx;private final CordovaWebView app;@@ -90,13 +93,17 @@ public class PluginManager {* Create plugins objects that have onload set.*/private void startupPlugins() {- for (PluginEntry entry : entryMap.values()) {- // Add a null entry to for each non-startup plugin to avoid ConcurrentModificationException- // When iterating plugins.- if (entry.onload) {- getPlugin(entry.service);- } else {- pluginMap.put(entry.service, null);+ synchronized (entryMap) {+ for (PluginEntry entry : entryMap.values()) {+ // Add a null entry to for each non-startup plugin to avoid ConcurrentModificationException+ // When iterating plugins.+ if (entry.onload) {+ getPlugin(entry.service);+ }+ else {+ LOG.d(TAG, "startupPlugins: put - " + entry.service);+ pluginMap.put(entry.service, null);+ }}}}@@ -169,6 +176,7 @@ public class PluginManager {ret = instantiatePlugin(pe.pluginClass);}ret.privateInitialize(service, ctx, app, app.getPreferences());+ LOG.d(TAG, "getPlugin - put: " + service);pluginMap.put(service, ret);}return ret;@@ -196,6 +204,7 @@ public class PluginManager {this.entryMap.put(entry.service, entry);if (entry.plugin != null) {entry.plugin.privateInitialize(entry.service, ctx, app, app.getPreferences());+ LOG.d(TAG, "addService: put - " + entry.service);pluginMap.put(entry.service, entry.plugin);}}@@ -206,9 +215,11 @@ public class PluginManager {* @param multitasking Flag indicating if multitasking is turned on for app*/public void onPause(boolean multitasking) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onPause(multitasking);+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onPause(multitasking);+ }}}}@@ -226,9 +237,11 @@ public class PluginManager {**/public boolean onReceivedHttpAuthRequest(CordovaWebView view, ICordovaHttpAuthHandler handler, String host, String realm) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null && plugin.onReceivedHttpAuthRequest(app, handler, host, realm)) {- return true;+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null && plugin.onReceivedHttpAuthRequest(app, handler, host, realm)) {+ return true;+ }}}return false;@@ -245,9 +258,11 @@ public class PluginManager {**/public boolean onReceivedClientCertRequest(CordovaWebView view, ICordovaClientCertRequest request) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null && plugin.onReceivedClientCertRequest(app, request)) {- return true;+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null && plugin.onReceivedClientCertRequest(app, request)) {+ return true;+ }}}return false;@@ -259,9 +274,11 @@ public class PluginManager {* @param multitasking Flag indicating if multitasking is turned on for app*/public void onResume(boolean multitasking) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onResume(multitasking);+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onResume(multitasking);+ }}}}@@ -270,9 +287,11 @@ public class PluginManager {* Called when the activity is becoming visible to the user.*/public void onStart() {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onStart();+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onStart();+ }}}}@@ -281,9 +300,11 @@ public class PluginManager {* Called when the activity is no longer visible to the user.*/public void onStop() {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onStop();+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onStop();+ }}}}@@ -292,9 +313,11 @@ public class PluginManager {* The final call you receive before your activity is destroyed.*/public void onDestroy() {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onDestroy();+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onDestroy();+ }}}}@@ -307,11 +330,22 @@ public class PluginManager {* @return Object to stop propagation or null*/public Object postMessage(String id, Object data) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- Object obj = plugin.onMessage(id, data);- if (obj != null) {- return obj;+ LOG.d(TAG, "postMessage: " + id);+ synchronized (this.pluginMap) {+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {+ this.pluginMap.forEach((s, plugin) -> {+ if (plugin != null) {+ plugin.onMessage(id, data);+ }+ });+ } else {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ Object obj = plugin.onMessage(id, data);+ if (obj != null) {+ return obj;+ }+ }}}}@@ -322,9 +356,11 @@ public class PluginManager {* Called when the activity receives a new intent.*/public void onNewIntent(Intent intent) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onNewIntent(intent);+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onNewIntent(intent);+ }}}}@@ -341,12 +377,14 @@ public class PluginManager {* false to block the resource.*/public boolean shouldAllowRequest(String url) {- for (PluginEntry entry : this.entryMap.values()) {- CordovaPlugin plugin = pluginMap.get(entry.service);- if (plugin != null) {- Boolean result = plugin.shouldAllowRequest(url);- if (result != null) {- return result;+ synchronized (this.entryMap) {+ for (PluginEntry entry : this.entryMap.values()) {+ CordovaPlugin plugin = pluginMap.get(entry.service);+ if (plugin != null) {+ Boolean result = plugin.shouldAllowRequest(url);+ if (result != null) {+ return result;+ }}}}@@ -379,12 +417,14 @@ public class PluginManager {* false to block the navigation.*/public boolean shouldAllowNavigation(String url) {- for (PluginEntry entry : this.entryMap.values()) {- CordovaPlugin plugin = pluginMap.get(entry.service);- if (plugin != null) {- Boolean result = plugin.shouldAllowNavigation(url);- if (result != null) {- return result;+ synchronized (this.entryMap) {+ for (PluginEntry entry : this.entryMap.values()) {+ CordovaPlugin plugin = pluginMap.get(entry.service);+ if (plugin != null) {+ Boolean result = plugin.shouldAllowNavigation(url);+ if (result != null) {+ return result;+ }}}}@@ -398,12 +438,14 @@ public class PluginManager {* Called when the webview is requesting the exec() bridge be enabled.*/public boolean shouldAllowBridgeAccess(String url) {- for (PluginEntry entry : this.entryMap.values()) {- CordovaPlugin plugin = pluginMap.get(entry.service);- if (plugin != null) {- Boolean result = plugin.shouldAllowBridgeAccess(url);- if (result != null) {- return result;+ synchronized (this.entryMap) {+ for (PluginEntry entry : this.entryMap.values()) {+ CordovaPlugin plugin = pluginMap.get(entry.service);+ if (plugin != null) {+ Boolean result = plugin.shouldAllowBridgeAccess(url);+ if (result != null) {+ return result;+ }}}}@@ -425,12 +467,14 @@ public class PluginManager {* false to block the intent.*/public Boolean shouldOpenExternalUrl(String url) {- for (PluginEntry entry : this.entryMap.values()) {- CordovaPlugin plugin = pluginMap.get(entry.service);- if (plugin != null) {- Boolean result = plugin.shouldOpenExternalUrl(url);- if (result != null) {- return result;+ synchronized (this.entryMap) {+ for (PluginEntry entry : this.entryMap.values()) {+ CordovaPlugin plugin = pluginMap.get(entry.service);+ if (plugin != null) {+ Boolean result = plugin.shouldOpenExternalUrl(url);+ if (result != null) {+ return result;+ }}}}@@ -446,32 +490,38 @@ public class PluginManager {* @return Return false to allow the URL to load, return true to prevent the URL from loading.*/public boolean onOverrideUrlLoading(String url) {- for (PluginEntry entry : this.entryMap.values()) {- CordovaPlugin plugin = pluginMap.get(entry.service);- if (plugin != null && plugin.onOverrideUrlLoading(url)) {- return true;+ synchronized (this.entryMap) {+ for (PluginEntry entry : this.entryMap.values()) {+ CordovaPlugin plugin = pluginMap.get(entry.service);+ if (plugin != null && plugin.onOverrideUrlLoading(url)) {+ return true;+ }}+ return false;}- return false;}/*** Called when the app navigates or refreshes.*/public void onReset() {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onReset();+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onReset();+ }}}}Uri remapUri(Uri uri) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- Uri ret = plugin.remapUri(uri);- if (ret != null) {- return ret;+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ Uri ret = plugin.remapUri(uri);+ if (ret != null) {+ return ret;+ }}}}@@ -504,20 +554,24 @@ public class PluginManager {* @param newConfig The new device configuration*/public void onConfigurationChanged(Configuration newConfig) {- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- plugin.onConfigurationChanged(newConfig);+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ plugin.onConfigurationChanged(newConfig);+ }}}}public Bundle onSaveInstanceState() {Bundle state = new Bundle();- for (CordovaPlugin plugin : this.pluginMap.values()) {- if (plugin != null) {- Bundle pluginState = plugin.onSaveInstanceState();- if(pluginState != null) {- state.putBundle(plugin.getServiceName(), pluginState);+ synchronized (this.pluginMap) {+ for (CordovaPlugin plugin : this.pluginMap.values()) {+ if (plugin != null) {+ Bundle pluginState = plugin.onSaveInstanceState();+ if (pluginState != null) {+ state.putBundle(plugin.getServiceName(), pluginState);+ }}}}diff --git a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewEngine.java b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewEngine.javaindex 3201c7440..e703f09d4 100755--- a/cordova/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewEngine.java+++ b/cordova/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewEngine.java@@ -152,6 +152,15 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {settings.setJavaScriptCanOpenWindowsAutomatically(true);settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);+ /**+ * https://developer.android.com/reference/android/webkit/WebSettings#setAllowFileAccess(boolean)+ *+ * SDK >= 30 has recently set this value to false by default.+ * It is recommended to turn off this settings To prevent possible security issues targeting Build.VERSION_CODES.Q and earlier.+ * For existing functionality, this setting is set to true. In a future release, this should be defaulted to false.+ */+ settings.setAllowFileAccess(true);+String manufacturer = android.os.Build.MANUFACTURER;LOG.d(TAG, "CordovaWebView is running on device made by: " + manufacturer);diff --git a/cordova/platforms/android/android.json b/cordova/platforms/android/android.jsonindex 30594bdd3..17c6736fe 100644--- a/cordova/platforms/android/android.json+++ b/cordova/platforms/android/android.json@@ -10,11 +10,11 @@"/manifest/application/activity": [{"xml": "<intent-filter><action android:name=\"android.intent.action.VIEW\" /><category android:name=\"android.intent.category.DEFAULT\" /><category android:name=\"android.intent.category.BROWSABLE\" /><data android:mimeType=\"application/pdf\" android:scheme=\"file\" /><data android:mimeType=\"text/plain\" android:scheme=\"file\" /><data android:mimeType=\"image/x-windows-bmp\" android:scheme=\"file\" /><data android:mimeType=\"image/gif\" android:scheme=\"file\" /><data android:mimeType=\"image/png\" android:scheme=\"file\" /><data android:mimeType=\"image/jpeg\" android:scheme=\"file\" /><data android:mimeType=\"image/webp\" android:scheme=\"file\" /><data android:mimeType=\"video/webm\" android:scheme=\"file\" /><data android:mimeType=\"video/ogg\" android:scheme=\"file\" /><data android:mimeType=\"text/html\" android:scheme=\"file\" /><data android:mimeType=\"application/json\" android:scheme=\"file\" /></intent-filter>",- "count": 3+ "count": 17},{"xml": "<intent-filter><action android:name=\"android.intent.action.VIEW\" /><category android:name=\"android.intent.category.DEFAULT\" /><category android:name=\"android.intent.category.BROWSABLE\" /><data android:host=\"*\" android:mimeType=\"*/*\" android:pathPattern=\"..json\" android:scheme=\"file\" /><data android:host=\"*\" android:mimeType=\"*/*\" android:pathPattern=\"..mht\" android:scheme=\"file\" /><data android:host=\"*\" android:mimeType=\"*/*\" android:pathPattern=\"..mhtml\" android:scheme=\"file\" /><data android:host=\"*\" android:mimeType=\"*/*\" android:pathPattern=\"..md\" android:scheme=\"file\" /><data android:host=\"*\" android:mimeType=\"*/*\" android:pathPattern=\"..md.txt\" android:scheme=\"file\" /><data android:host=\"*\" android:mimeType=\"*/*\" android:pathPattern=\"..markdown\" android:scheme=\"file\" /><data android:host=\"*\" android:mimeType=\"*/*\" android:pathPattern=\"..ogv\" android:scheme=\"file\" /></intent-filter>",- "count": 3+ "count": 17},{"xml": "<intent-filter><action android:name=\"com.darryncampbell.cordova.plugin.intent.ACTION\" /><category android:name=\"android.intent.category.DEFAULT\" /></intent-filter>",@@ -24,7 +24,7 @@"/manifest/application": [{"xml": "<provider android:authorities=\"${applicationId}.provider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"android.support.v4.content.FileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/mnk_file_path\" /></provider>",- "count": 3+ "count": 17},{"xml": "<provider android:authorities=\"${applicationId}.darryncampbell.cordova.plugin.intent.fileprovider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"com.darryncampbell.cordova.plugin.intent.CordovaPluginIntentFileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/provider_paths\" /></provider>",@@ -50,7 +50,7 @@"/manifest": [{"xml": "<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />",- "count": 3+ "count": 2},{"xml": "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" />",@@ -58,7 +58,7 @@},{"xml": "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />",- "count": 2+ "count": 1},{"xml": "<uses-permission android:name=\"android.permission.WAKE_LOCK\" />",@@ -81,7 +81,7 @@],"application": [{- "xml": "<provider android:authorities=\"${applicationId}.provider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"org.apache.cordova.camera.FileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/camera_provider_paths\" /></provider>",+ "xml": "<provider android:authorities=\"${applicationId}.cordova.plugin.camera.provider\" android:exported=\"false\" android:grantUriPermissions=\"true\" android:name=\"org.apache.cordova.camera.FileProvider\"><meta-data android:name=\"android.support.FILE_PROVIDER_PATHS\" android:resource=\"@xml/camera_provider_paths\" /></provider>","count": 1},{@@ -154,35 +154,6 @@}]}- },- "config.xml": {- "parents": {- "/*": [- {- "xml": "<feature name=\"Chooser\"><param name=\"android-package\" value=\"com.cyph.cordova.Chooser\" /></feature>",- "count": 1- }- ]- }- },- "app/src/main/AndroidManifest.xml": {- "parents": {- "/manifest/application": [- {- "xml": "<application android:requestLegacyExternalStorage=\"true\" />",- "count": 1,- "mode": "merge",- "plugin": "cordova-plugin-file",- "oldAttrib": {- "android:hardwareAccelerated": "true",- "android:icon": "@mipmap/ic_launcher",- "android:label": "@string/app_name",- "android:requestLegacyExternalStorage": "true",- "android:supportsRtl": "true"- }- }- ]- }}}},@@ -212,9 +183,6 @@"ANDROID_SUPPORT_V4_VERSION": "27.+","PACKAGE_NAME": "org.tagspaces.mobileapp"},- "cordova-plugin-chooser": {- "PACKAGE_NAME": "org.tagspaces.mobileapp"- },"cordova-plugin-file": {"PACKAGE_NAME": "org.tagspaces.mobileapp"},@@ -229,7 +197,6 @@"PACKAGE_NAME": "org.tagspaces.mobileapp"},"cordova-plugin-x-socialsharing": {- "ANDROID_SUPPORT_V4_VERSION": "24.1.1+","PACKAGE_NAME": "org.tagspaces.mobileapp"}},@@ -308,14 +275,6 @@"CameraPopoverHandle"]},- {- "id": "cordova-plugin-chooser.Chooser",- "file": "plugins/cordova-plugin-chooser/www/chooser.js",- "pluginId": "cordova-plugin-chooser",- "clobbers": [- "chooser"- ]- },{"id": "cordova-plugin-file.DirectoryEntry","file": "plugins/cordova-plugin-file/www/DirectoryEntry.js",@@ -520,12 +479,11 @@"cordova-plugin-androidx-adapter": "1.1.3","cordova-plugin-device": "2.0.3","cordova-plugin-background-mode": "0.7.3",- "cordova-plugin-camera": "4.1.0",- "cordova-plugin-chooser": "1.3.1",- "cordova-plugin-file": "7.0.0-dev",- "cordova-plugin-file-opener2": "3.0.4",+ "cordova-plugin-camera": "5.0.1",+ "cordova-plugin-file": "6.0.2",+ "cordova-plugin-file-opener2": "3.0.5","cordova-plugin-whitelist": "1.3.4","es6-promise-plugin": "4.2.2",- "cordova-plugin-x-socialsharing": "5.6.8"+ "cordova-plugin-x-socialsharing": "6.0.3"}}diff --git a/cordova/platforms/android/app/build.gradle b/cordova/platforms/android/app/build.gradleindex 31da2c02c..063289491 100644--- a/cordova/platforms/android/app/build.gradle+++ b/cordova/platforms/android/app/build.gradle@@ -44,11 +44,8 @@ buildscript {ext.kotlin_version = gradlePluginKotlinVersion}- repositories {- mavenCentral()- google()- jcenter()- }+ apply from: 'repositories.gradle'+ repositories reposdependencies {apply from: '../CordovaLib/cordova.gradle'@@ -82,10 +79,8 @@ buildscript {// Allow plugins to declare Maven dependencies via build-extras.gradle.allprojects {- repositories {- mavenCentral()- jcenter()- }+ apply from: 'repositories.gradle'+ repositories repos}task wrapper(type: Wrapper) {diff --git a/cordova/platforms/android/app/repositories.gradle b/cordova/platforms/android/app/repositories.gradlenew file mode 100644index 000000000..3661e1311--- /dev/null+++ b/cordova/platforms/android/app/repositories.gradle@@ -0,0 +1,23 @@+/* Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+*/++ext.repos = {+ mavenCentral()+ google()+ jcenter()+}diff --git a/cordova/platforms/android/app/src/main/AndroidManifest.xml b/cordova/platforms/android/app/src/main/AndroidManifest.xmlindex b7eec29fd..1a3383be7 100644--- a/cordova/platforms/android/app/src/main/AndroidManifest.xml+++ b/cordova/platforms/android/app/src/main/AndroidManifest.xml@@ -2,7 +2,7 @@<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="org.tagspaces.mobileapp" xmlns:android="http://schemas.android.com/apk/res/android"><supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /><uses-permission android:name="android.permission.INTERNET" />- <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:requestLegacyExternalStorage="true" android:supportsRtl="true">+ <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true"><activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize"><intent-filter android:label="@string/launcher_name"><action android:name="android.intent.action.MAIN" />@@ -41,9 +41,6 @@<category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>- <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">- <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/mnk_file_path" />- </provider><provider android:authorities="${applicationId}.darryncampbell.cordova.plugin.intent.fileprovider" android:exported="false" android:grantUriPermissions="true" android:name="com.darryncampbell.cordova.plugin.intent.CordovaPluginIntentFileProvider"><meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /></provider>@@ -60,7 +57,7 @@</intent-filter></activity><service android:name="de.appplant.cordova.plugin.background.ForegroundService" />- <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">+ <provider android:authorities="${applicationId}.cordova.plugin.camera.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider"><meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" /></provider><provider android:authorities="${applicationId}.fileOpener2.provider" android:exported="false" android:grantUriPermissions="true" android:name="io.github.pwlin.cordova.plugins.fileopener2.FileProvider">@@ -74,6 +71,9 @@<provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider"><meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" /></provider>+ <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">+ <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/mnk_file_path" />+ </provider></application><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />diff --git a/cordova/platforms/android/app/src/main/java/com/cyph/cordova/Chooser.java b/cordova/platforms/android/app/src/main/java/com/cyph/cordova/Chooser.javadeleted file mode 100755index 04978bff8..000000000--- a/cordova/platforms/android/app/src/main/java/com/cyph/cordova/Chooser.java+++ /dev/null@@ -1,156 +0,0 @@-package com.cyph.cordova;--import android.app.Activity;-import android.content.ContentResolver;-import android.content.Intent;-import android.database.Cursor;-import android.net.Uri;-import android.provider.MediaStore;-import android.util.Base64;--import java.io.ByteArrayOutputStream;-import java.io.InputStream;-import java.io.IOException;-import java.lang.Exception;--import org.apache.cordova.CallbackContext;-import org.apache.cordova.CordovaPlugin;-import org.apache.cordova.PluginResult;-import org.json.JSONArray;-import org.json.JSONException;-import org.json.JSONObject;---public class Chooser extends CordovaPlugin {- private static final String ACTION_OPEN = "getFile";- private static final int PICK_FILE_REQUEST = 1;- private static final String TAG = "Chooser";-- /** @see https://stackoverflow.com/a/17861016/459881 */- public static byte[] getBytesFromInputStream (InputStream is) throws IOException {- ByteArrayOutputStream os = new ByteArrayOutputStream();- byte[] buffer = new byte[0xFFFF];-- for (int len = is.read(buffer); len != -1; len = is.read(buffer)) {- os.write(buffer, 0, len);- }-- return os.toByteArray();- }-- /** @see https://stackoverflow.com/a/23270545/459881 */- public static String getDisplayName (ContentResolver contentResolver, Uri uri) {- String[] projection = {MediaStore.MediaColumns.DISPLAY_NAME};- Cursor metaCursor = contentResolver.query(uri, projection, null, null, null);-- if (metaCursor != null) {- try {- if (metaCursor.moveToFirst()) {- return metaCursor.getString(0);- }- } finally {- metaCursor.close();- }- }-- return "File";- }--- private CallbackContext callback;- private Boolean includeData;-- public void chooseFile (CallbackContext callbackContext, String accept, Boolean includeData) {- Intent intent = new Intent(Intent.ACTION_GET_CONTENT);- intent.setType("*/*");- if (!accept.equals("*/*")) {- intent.putExtra(Intent.EXTRA_MIME_TYPES, accept.split(","));- }- intent.addCategory(Intent.CATEGORY_OPENABLE);- intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);- intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);- this.includeData = includeData;-- Intent chooser = Intent.createChooser(intent, "Select File");- cordova.startActivityForResult(this, chooser, Chooser.PICK_FILE_REQUEST);-- PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);- pluginResult.setKeepCallback(true);- this.callback = callbackContext;- callbackContext.sendPluginResult(pluginResult);- }-- @Override- public boolean execute (- String action,- JSONArray args,- CallbackContext callbackContext- ) {- try {- if (action.equals(Chooser.ACTION_OPEN)) {- this.chooseFile(callbackContext, args.getString(0), args.getBoolean(1));- return true;- }- }- catch (JSONException err) {- this.callback.error("Execute failed: " + err.toString());- }-- return false;- }-- @Override- public void onActivityResult (int requestCode, int resultCode, Intent data) {- try {- if (requestCode == Chooser.PICK_FILE_REQUEST && this.callback != null) {- if (resultCode == Activity.RESULT_OK) {- Uri uri = data.getData();-- if (uri != null) {- ContentResolver contentResolver =- this.cordova.getActivity().getContentResolver()- ;-- String name = Chooser.getDisplayName(contentResolver, uri);-- String mediaType = contentResolver.getType(uri);- if (mediaType == null || mediaType.isEmpty()) {- mediaType = "application/octet-stream";- }-- String base64 = "";-- if (this.includeData) {- byte[] bytes = Chooser.getBytesFromInputStream(- contentResolver.openInputStream(uri)- );-- base64 = Base64.encodeToString(bytes, Base64.DEFAULT);- }-- JSONObject result = new JSONObject();-- result.put("data", base64);- result.put("mediaType", mediaType);- result.put("name", name);- result.put("uri", uri.toString());-- this.callback.success(result.toString());- }- else {- this.callback.error("File URI was null.");- }- }- else if (resultCode == Activity.RESULT_CANCELED) {- this.callback.success("RESULT_CANCELED");- }- else {- this.callback.error(resultCode);- }- }- }- catch (Exception err) {- this.callback.error("Failed to read file: " + err.toString());- }- }-}diff --git a/cordova/platforms/android/app/src/main/java/nl/xservices/plugins/SocialSharing.java b/cordova/platforms/android/app/src/main/java/nl/xservices/plugins/SocialSharing.javaindex e72446f42..e60340ef6 100644--- a/cordova/platforms/android/app/src/main/java/nl/xservices/plugins/SocialSharing.java+++ b/cordova/platforms/android/app/src/main/java/nl/xservices/plugins/SocialSharing.java@@ -87,10 +87,10 @@ public class SocialSharing extends CordovaPlugin {} else if (ACTION_SHARE_VIA_TWITTER_EVENT.equals(action)) {return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "twitter", null, false, true);} else if (ACTION_SHARE_VIA_FACEBOOK_EVENT.equals(action)) {- return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.isNull(3) ? args.getJSONArray(2) : null, args.getString(3), "com.facebook.katana", null, false, true, "com.facebook.composer.shareintent");+ return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.isNull(3) ? args.getJSONArray(2) : new JSONArray(), args.getString(3), "com.facebook.katana", null, false, true, "com.facebook.composer.shareintent");} else if (ACTION_SHARE_VIA_FACEBOOK_WITH_PASTEMESSAGEHINT.equals(action)) {this.pasteMessage = args.getString(4);- return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.isNull(3) ? args.getJSONArray(2) : null, args.getString(3), "com.facebook.katana", null, false, true, "com.facebook.composer.shareintent");+ return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.isNull(3) ? args.getJSONArray(2) : new JSONArray(), args.getString(3), "com.facebook.katana", null, false, true, "com.facebook.composer.shareintent");} else if (ACTION_SHARE_VIA_WHATSAPP_EVENT.equals(action)) {if (notEmpty(args.getString(4))) { // abidreturn shareViaWhatsAppDirectly(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), args.getString(4));@@ -103,7 +103,7 @@ public class SocialSharing extends CordovaPlugin {if (notEmpty(args.getString(0))) {copyHintToClipboard(args.getString(0), "Instagram paste message");}- return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "instagram", null, false, true);+ return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "com.instagram.android", null, false, true, "com.instagram.share.handleractivity.ShareHandlerActivity");} else if (ACTION_CAN_SHARE_VIA.equals(action)) {return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), args.getString(4), null, true, true);} else if (ACTION_CAN_SHARE_VIA_EMAIL.equals(action)) {@@ -440,6 +440,9 @@ public class SocialSharing extends CordovaPlugin {}}saveFile(getBytes(connection.getInputStream()), dir, filename);+ // update file type+ String fileType = getMIMEType(image);+ sendIntent.setType(fileType);} else {saveFile(getBytes(webView.getContext().getAssets().open(image)), dir, filename);}diff --git a/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java b/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.javaindex c0a03904b..614935d19 100644--- a/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java+++ b/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/CameraLauncher.java@@ -21,6 +21,7 @@ package org.apache.cordova.camera;import android.Manifest;import android.app.Activity;import android.content.ActivityNotFoundException;+import android.content.ContentResolver;import android.content.ContentValues;import android.content.Intent;import android.content.pm.PackageManager;@@ -34,6 +35,7 @@ import android.media.ExifInterface;import android.media.MediaScannerConnection;import android.media.MediaScannerConnection.MediaScannerConnectionClient;import android.net.Uri;+import android.os.Build;import android.os.Bundle;import android.os.Environment;import android.provider.MediaStore;@@ -51,7 +53,6 @@ import org.json.JSONException;import java.io.ByteArrayOutputStream;import java.io.File;-import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;@@ -69,7 +70,6 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectprivate static final int DATA_URL = 0; // Return base64 encoded stringprivate static final int FILE_URI = 1; // Return file uri (content://media/external/images/media/2 for Android)- private static final int NATIVE_URI = 2; // On Android, this is the same as FILE_URIprivate static final int PHOTOLIBRARY = 0; // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)private static final int CAMERA = 1; // Take picture from camera@@ -109,7 +109,8 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectprivate int mQuality; // Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality)private int targetWidth; // desired width of the imageprivate int targetHeight; // desired height of the image- private CordovaUri imageUri; // Uri of captured image+ private Uri imageUri; // Uri of captured image+ private String imageFilePath; // File where the image is storedprivate int encodingType; // Type of encoding to useprivate int mediaType; // What type of media to retrieveprivate int destType; // Source type (needs to be saved for the permission handling)@@ -127,6 +128,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectprivate MediaScannerConnection conn; // Used to update gallery app with newly-written filesprivate Uri scanMe; // Uri of image to be added to content storeprivate Uri croppedUri;+ private String croppedFilePath;private ExifHelper exifData; // Exif data from sourceprivate String applicationId;@@ -220,17 +222,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect//--------------------------------------------------------------------------private String getTempDirectoryPath() {- File cache = null;-- // SD Card Mounted- if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {- cache = cordova.getActivity().getExternalCacheDir();- }- // Use internal storage- else {- cache = cordova.getActivity().getCacheDir();- }-+ File cache = cordova.getActivity().getCacheDir();// Create the cache directory if it doesn't existcache.mkdirs();return cache.getAbsolutePath();@@ -300,10 +292,11 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect// Specify file so that large image is captured and returnedFile photo = createCaptureFile(encodingType);- this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),- applicationId + ".provider",- photo));- intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri.getCorrectUri());+ this.imageFilePath = photo.getAbsolutePath();+ this.imageUri = FileProvider.getUriForFile(cordova.getActivity(),+ applicationId + ".cordova.plugin.camera.provider",+ photo);+ intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);//We can write to this URI, this will hopefully allow us to write files to get to the next stepintent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);@@ -370,6 +363,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectIntent intent = new Intent();String title = GET_PICTURE;croppedUri = null;+ croppedFilePath = null;if (this.mediaType == PICTURE) {intent.setType("image/*");if (this.allowEdit) {@@ -385,8 +379,9 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectintent.putExtra("aspectX", 1);intent.putExtra("aspectY", 1);}- File photo = createCaptureFile(JPEG);- croppedUri = Uri.fromFile(photo);+ File croppedFile = createCaptureFile(JPEG);+ croppedFilePath = croppedFile.getAbsolutePath();+ croppedUri = Uri.fromFile(croppedFile);intent.putExtra(MediaStore.EXTRA_OUTPUT, croppedUri);} else {intent.setAction(Intent.ACTION_GET_CONTENT);@@ -411,57 +406,57 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect}}-- /**- * Brings up the UI to perform crop on passed image URI- *- * @param picUri- */- private void performCrop(Uri picUri, int destType, Intent cameraIntent) {- try {- Intent cropIntent = new Intent("com.android.camera.action.CROP");- // indicate image type and Uri- cropIntent.setDataAndType(picUri, "image/*");- // set crop properties- cropIntent.putExtra("crop", "true");+ /**+ * Brings up the UI to perform crop on passed image URI+ *+ * @param picUri+ */+ private void performCrop(Uri picUri, int destType, Intent cameraIntent) {+ try {+ Intent cropIntent = new Intent("com.android.camera.action.CROP");+ // indicate image type and Uri+ cropIntent.setDataAndType(picUri, "image/*");+ // set crop properties+ cropIntent.putExtra("crop", "true");- // indicate output X and Y- if (targetWidth > 0) {- cropIntent.putExtra("outputX", targetWidth);- }- if (targetHeight > 0) {- cropIntent.putExtra("outputY", targetHeight);- }- if (targetHeight > 0 && targetWidth > 0 && targetWidth == targetHeight) {- cropIntent.putExtra("aspectX", 1);- cropIntent.putExtra("aspectY", 1);- }- // create new file handle to get full resolution crop- croppedUri = Uri.fromFile(createCaptureFile(this.encodingType, System.currentTimeMillis() + ""));- cropIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);- cropIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);- cropIntent.putExtra("output", croppedUri);+ // indicate output X and Y+ if (targetWidth > 0) {+ cropIntent.putExtra("outputX", targetWidth);+ }+ if (targetHeight > 0) {+ cropIntent.putExtra("outputY", targetHeight);+ }+ if (targetHeight > 0 && targetWidth > 0 && targetWidth == targetHeight) {+ cropIntent.putExtra("aspectX", 1);+ cropIntent.putExtra("aspectY", 1);+ }+ // create new file handle to get full resolution crop+ croppedFilePath = createCaptureFile(this.encodingType, System.currentTimeMillis() + "").getAbsolutePath();+ croppedUri = Uri.parse(croppedFilePath);+ cropIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);+ cropIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);+ cropIntent.putExtra("output", croppedUri);- // start the activity - we handle returning in onActivityResult+ // start the activity - we handle returning in onActivityResult- if (this.cordova != null) {- this.cordova.startActivityForResult((CordovaPlugin) this,- cropIntent, CROP_CAMERA + destType);+ if (this.cordova != null) {+ this.cordova.startActivityForResult((CordovaPlugin) this,+ cropIntent, CROP_CAMERA + destType);+ }+ } catch (ActivityNotFoundException anfe) {+ LOG.e(LOG_TAG, "Crop operation not supported on this device");+ try {+ processResultFromCamera(destType, cameraIntent);+ }+ catch (IOException e)+ {+ e.printStackTrace();+ LOG.e(LOG_TAG, "Unable to write to file");+ }}- } catch (ActivityNotFoundException anfe) {- LOG.e(LOG_TAG, "Crop operation not supported on this device");- try {- processResultFromCamera(destType, cameraIntent);- }- catch (IOException e)- {- e.printStackTrace();- LOG.e(LOG_TAG, "Unable to write to file");- }}- }/*** Applies all needed transformation to the image received from the camera.@@ -476,8 +471,8 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectExifHelper exif = new ExifHelper();String sourcePath = (this.allowEdit && this.croppedUri != null) ?- FileHelper.stripFileProtocol(this.croppedUri.toString()) :- this.imageUri.getFilePath();+ this.croppedFilePath :+ this.imageFilePath;if (this.encodingType == JPEG) {@@ -499,16 +494,18 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect// in the gallery and the modified image is saved in the temporary// directoryif (this.saveToPhotoAlbum) {- galleryUri = Uri.fromFile(new File(getPicturesPath()));+ GalleryPathVO galleryPathVO = getPicturesPath();+ galleryUri = Uri.fromFile(new File(galleryPathVO.getGalleryPath()));if (this.allowEdit && this.croppedUri != null) {writeUncompressedImage(croppedUri, galleryUri);} else {- Uri imageUri = this.imageUri.getFileUri();- writeUncompressedImage(imageUri, galleryUri);+ if (Build.VERSION.SDK_INT <= 28) { // Between LOLLIPOP_MR1 and P, can be changed later to the constant Build.VERSION_CODES.P+ writeTakenPictureToGalleryLowerThanAndroidQ(galleryUri);+ } else { // Android Q or higher+ writeTakenPictureToGalleryStartingFromAndroidQ(galleryPathVO);+ }}-- refreshGallery(galleryUri);}// If sending base64 image back@@ -536,7 +533,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect}// If sending filename back- else if (destType == FILE_URI || destType == NATIVE_URI) {+ else if (destType == FILE_URI) {// If all this is true we shouldn't compress the image.if (this.targetHeight == -1 && this.targetWidth == -1 && this.mQuality == 100 &&!this.correctOrientation) {@@ -549,10 +546,10 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectUri uri = Uri.fromFile(createCaptureFile(this.encodingType, System.currentTimeMillis() + ""));if (this.allowEdit && this.croppedUri != null) {- Uri croppedUri = Uri.fromFile(new File(getFileNameFromUri(this.croppedUri)));+ Uri croppedUri = Uri.parse(croppedFilePath);writeUncompressedImage(croppedUri, uri);} else {- Uri imageUri = this.imageUri.getFileUri();+ Uri imageUri = this.imageUri;writeUncompressedImage(imageUri, uri);}@@ -572,9 +569,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect// Add compressed version of captured image to returned media store UriOutputStream os = this.cordova.getActivity().getContentResolver().openOutputStream(uri);- CompressFormat compressFormat = encodingType == JPEG ?- CompressFormat.JPEG :- CompressFormat.PNG;+ CompressFormat compressFormat = getCompressFormatForEncodingType(encodingType);bitmap.compress(compressFormat, this.mQuality, os);os.close();@@ -598,22 +593,45 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectthrow new IllegalStateException();}- this.cleanup(FILE_URI, this.imageUri.getFileUri(), galleryUri, bitmap);+ this.cleanup(FILE_URI, this.imageUri, galleryUri, bitmap);bitmap = null;}- private String getPicturesPath() {+ private void writeTakenPictureToGalleryLowerThanAndroidQ(Uri galleryUri) throws IOException {+ writeUncompressedImage(imageUri, galleryUri);+ refreshGallery(galleryUri);+ }++ private void writeTakenPictureToGalleryStartingFromAndroidQ(GalleryPathVO galleryPathVO) throws IOException {+ // Starting from Android Q, working with the ACTION_MEDIA_SCANNER_SCAN_FILE intent is deprecated+ // https://developer.android.com/reference/android/content/Intent#ACTION_MEDIA_SCANNER_SCAN_FILE+ // we must start working with the MediaStore from Android Q on.+ ContentResolver resolver = this.cordova.getActivity().getContentResolver();+ ContentValues contentValues = new ContentValues();+ contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, galleryPathVO.getGalleryFileName());+ contentValues.put(MediaStore.MediaColumns.MIME_TYPE, getMimetypeForFormat(encodingType));+ Uri galleryOutputUri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);++ InputStream fileStream = org.apache.cordova.camera.FileHelper.getInputStreamFromUriString(imageUri.toString(), cordova);+ writeUncompressedImage(fileStream, galleryOutputUri);+ }++ private CompressFormat getCompressFormatForEncodingType(int encodingType) {+ return encodingType == JPEG ? CompressFormat.JPEG : CompressFormat.PNG;+ }++ private GalleryPathVO getPicturesPath() {String timeStamp = new SimpleDateFormat(TIME_FORMAT).format(new Date());String imageFileName = "IMG_" + timeStamp + (this.encodingType == JPEG ? JPEG_EXTENSION : PNG_EXTENSION);File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);storageDir.mkdirs();- String galleryPath = storageDir.getAbsolutePath() + "/" + imageFileName;- return galleryPath;+ return new GalleryPathVO(storageDir.getAbsolutePath(), imageFileName);}private void refreshGallery(Uri contentUri) {Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);+ // Starting from Android Q, working with the ACTION_MEDIA_SCANNER_SCAN_FILE intent is deprecatedmediaScanIntent.setData(contentUri);this.cordova.getActivity().sendBroadcast(mediaScanIntent);}@@ -645,9 +663,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectString modifiedPath = getTempDirectoryPath() + "/" + fileName;OutputStream os = new FileOutputStream(modifiedPath);- CompressFormat compressFormat = this.encodingType == JPEG ?- CompressFormat.JPEG :- CompressFormat.PNG;+ CompressFormat compressFormat = getCompressFormatForEncodingType(this.encodingType);bitmap.compress(compressFormat, this.mQuality, os);os.close();@@ -684,74 +700,80 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectreturn;}}- int rotate = 0;String fileLocation = FileHelper.getRealPath(uri, this.cordova);LOG.d(LOG_TAG, "File location is: " + fileLocation);String uriString = uri.toString();+ String finalLocation = fileLocation != null ? fileLocation : uriString;String mimeType = FileHelper.getMimeType(uriString, this.cordova);- // If you ask for video or the selected file doesn't have JPEG or PNG mime type- // there will be no attempt to resize any returned data- if (this.mediaType == VIDEO || !(JPEG_MIME_TYPE.equalsIgnoreCase(mimeType) || PNG_MIME_TYPE.equalsIgnoreCase(mimeType))) {- this.callbackContext.success(fileLocation);- }- else {+ if (finalLocation == null) {+ this.failPicture("Error retrieving result.");+ } else {- // This is a special case to just return the path as no scaling,- // rotating, nor compressing needs to be done- if (this.targetHeight == -1 && this.targetWidth == -1 &&- (destType == FILE_URI || destType == NATIVE_URI) && !this.correctOrientation &&- mimeType != null && mimeType.equalsIgnoreCase(getMimetypeForFormat(encodingType)))- {- this.callbackContext.success(uriString);- } else {- Bitmap bitmap = null;- try {- bitmap = getScaledAndRotatedBitmap(uriString);- } catch (IOException e) {- e.printStackTrace();- }- if (bitmap == null) {- LOG.d(LOG_TAG, "I either have a null image path or bitmap");- this.failPicture("Unable to create bitmap!");- return;- }+ // If you ask for video or the selected file doesn't have JPEG or PNG mime type+ // there will be no attempt to resize any returned data+ if (this.mediaType == VIDEO || !(JPEG_MIME_TYPE.equalsIgnoreCase(mimeType) || PNG_MIME_TYPE.equalsIgnoreCase(mimeType))) {+ this.callbackContext.success(finalLocation);+ }+ else {- // If sending base64 image back- if (destType == DATA_URL) {- this.processPicture(bitmap, this.encodingType);- }+ // This is a special case to just return the path as no scaling,+ // rotating, nor compressing needs to be done+ if (this.targetHeight == -1 && this.targetWidth == -1 &&+ destType == FILE_URI && !this.correctOrientation &&+ mimeType != null && mimeType.equalsIgnoreCase(getMimetypeForFormat(encodingType)))+ {+ this.callbackContext.success(finalLocation);+ } else {+ Bitmap bitmap = null;+ try {+ bitmap = getScaledAndRotatedBitmap(uriString);+ } catch (IOException e) {+ e.printStackTrace();+ }+ if (bitmap == null) {+ LOG.d(LOG_TAG, "I either have a null image path or bitmap");+ this.failPicture("Unable to create bitmap!");+ return;+ }- // If sending filename back- else if (destType == FILE_URI || destType == NATIVE_URI) {- // Did we modify the image?- if ( (this.targetHeight > 0 && this.targetWidth > 0) ||- (this.correctOrientation && this.orientationCorrected) ||- !mimeType.equalsIgnoreCase(getMimetypeForFormat(encodingType)))- {- try {- String modifiedPath = this.outputModifiedBitmap(bitmap, uri);- // The modified image is cached by the app in order to get around this and not have to delete you- // application cache I'm adding the current system time to the end of the file url.- this.callbackContext.success("file://" + modifiedPath + "?" + System.currentTimeMillis());-- } catch (Exception e) {- e.printStackTrace();- this.failPicture("Error retrieving image.");+ // If sending base64 image back+ if (destType == DATA_URL) {+ this.processPicture(bitmap, this.encodingType);+ }++ // If sending filename back+ else if (destType == FILE_URI) {+ // Did we modify the image?+ if ( (this.targetHeight > 0 && this.targetWidth > 0) ||+ (this.correctOrientation && this.orientationCorrected) ||+ !mimeType.equalsIgnoreCase(getMimetypeForFormat(encodingType)))+ {+ try {+ String modifiedPath = this.outputModifiedBitmap(bitmap, uri);+ // The modified image is cached by the app in order to get around this and not have to delete you+ // application cache I'm adding the current system time to the end of the file url.+ this.callbackContext.success("file://" + modifiedPath + "?" + System.currentTimeMillis());++ } catch (Exception e) {+ e.printStackTrace();+ this.failPicture("Error retrieving image.");+ }+ } else {+ this.callbackContext.success(finalLocation);}- } else {- this.callbackContext.success(fileLocation);}+ if (bitmap != null) {+ bitmap.recycle();+ bitmap = null;+ }+ System.gc();}- if (bitmap != null) {- bitmap.recycle();- bitmap = null;- }- System.gc();}}+}/**@@ -799,7 +821,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnecttry {if (this.allowEdit) {Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),- applicationId + ".provider",+ applicationId + ".cordova.plugin.camera.provider",createCaptureFile(this.encodingType));performCrop(tmpFile, destType, intent);} else {@@ -898,34 +920,11 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectprivate void writeUncompressedImage(Uri src, Uri dest) throws FileNotFoundException,IOException {- FileInputStream fis = new FileInputStream(FileHelper.stripFileProtocol(src.toString()));+ InputStream fis = FileHelper.getInputStreamFromUriString(src.toString(), cordova);writeUncompressedImage(fis, dest);}- /**- * Create entry in media store for image- *- * @return uri- */- private Uri getUriFromMediaStore() {- ContentValues values = new ContentValues();- values.put(MediaStore.Images.Media.MIME_TYPE, JPEG_MIME_TYPE);- Uri uri;- try {- uri = this.cordova.getActivity().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);- } catch (RuntimeException e) {- LOG.d(LOG_TAG, "Can't write to external media storage.");- try {- uri = this.cordova.getActivity().getContentResolver().insert(MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);- } catch (RuntimeException ex) {- LOG.d(LOG_TAG, "Can't write to internal media storage.");- return null;- }- }- return uri;- }-/*** Return a scaled and rotated bitmap based on the target width and height*@@ -1256,9 +1255,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect*/public void processPicture(Bitmap bitmap, int encodingType) {ByteArrayOutputStream jpeg_data = new ByteArrayOutputStream();- CompressFormat compressFormat = encodingType == JPEG ?- CompressFormat.JPEG :- CompressFormat.PNG;+ CompressFormat compressFormat = getCompressFormatForEncodingType(encodingType);try {if (bitmap.compress(compressFormat, mQuality, jpeg_data)) {@@ -1346,11 +1343,11 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectstate.putBoolean("saveToPhotoAlbum", this.saveToPhotoAlbum);if (this.croppedUri != null) {- state.putString(CROPPED_URI_KEY, this.croppedUri.toString());+ state.putString(CROPPED_URI_KEY, this.croppedFilePath);}if (this.imageUri != null) {- state.putString(IMAGE_URI_KEY, this.imageUri.getFileUri().toString());+ state.putString(IMAGE_URI_KEY, this.imageFilePath);}return state;@@ -1375,28 +1372,9 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnectif (state.containsKey(IMAGE_URI_KEY)) {//I have no idea what type of URI is being passed in- this.imageUri = new CordovaUri(Uri.parse(state.getString(IMAGE_URI_KEY)));+ this.imageUri = Uri.parse(state.getString(IMAGE_URI_KEY));}this.callbackContext = callbackContext;}-- /*- * This is dirty, but it does the job.- *- * Since the FilesProvider doesn't really provide you a way of getting a URL from the file,- * and since we actually need the Camera to create the file for us most of the time, we don't- * actually write the file, just generate the location based on a timestamp, we need to get it- * back from the Intent.- *- * However, the FilesProvider preserves the path, so we can at least write to it from here, since- * we own the context in this case.- */- private String getFileNameFromUri(Uri uri) {- String fullUri = uri.toString();- String partial_path = fullUri.split("external_files")[1];- File external_storage = Environment.getExternalStorageDirectory();- String path = external_storage.getAbsolutePath() + partial_path;- return path;- }}diff --git a/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/CordovaUri.java b/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/CordovaUri.javadeleted file mode 100644index 56e388667..000000000--- a/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/CordovaUri.java+++ /dev/null@@ -1,104 +0,0 @@-/*- Licensed to the Apache Software Foundation (ASF) under one- or more contributor license agreements. See the NOTICE file- distributed with this work for additional information- regarding copyright ownership. The ASF licenses this file- to you under the Apache License, Version 2.0 (the- "License"); you may not use this file except in compliance- with the License. You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing,- software distributed under the License is distributed on an- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY- KIND, either express or implied. See the License for the- specific language governing permissions and limitations- under the License.-*/--package org.apache.cordova.camera;--import android.net.Uri;-import android.os.Build;-import android.os.Environment;-import androidx.core.content.FileProvider;--import java.io.File;--/*- * This class exists because Andorid FilesProvider doesn't work on Android 4.4.4 and below and throws- * weird errors. I'm not sure why writing to shared cache directories is somehow verboten, but it is- * and this error is irritating for a Compatibility library to have.- *- */--public class CordovaUri {-- private Uri androidUri;- private String fileName;- private Uri fileUri;-- /*- * We always expect a FileProvider string to be passed in for the file that we create- *- */- CordovaUri (Uri inputUri)- {- //Determine whether the file is a content or file URI- if(inputUri.getScheme().equals("content"))- {- androidUri = inputUri;- fileName = getFileNameFromUri(androidUri);- fileUri = Uri.parse("file://" + fileName);- }- else- {- fileUri = inputUri;- fileName = FileHelper.stripFileProtocol(inputUri.toString());- }- }-- public Uri getFileUri()- {- return fileUri;- }-- public String getFilePath()- {- return fileName;- }-- /*- * This only gets called by takePicture- */-- public Uri getCorrectUri()- {- if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)- return androidUri;- else- return fileUri;- }-- /*- * This is dirty, but it does the job.- *- * Since the FilesProvider doesn't really provide you a way of getting a URL from the file,- * and since we actually need the Camera to create the file for us most of the time, we don't- * actually write the file, just generate the location based on a timestamp, we need to get it- * back from the Intent.- *- * However, the FilesProvider preserves the path, so we can at least write to it from here, since- * we own the context in this case.- */-- private String getFileNameFromUri(Uri uri) {- String fullUri = uri.toString();- String partial_path = fullUri.split("external_files")[1];- File external_storage = Environment.getExternalStorageDirectory();- String path = external_storage.getAbsolutePath() + partial_path;- return path;-- }-}diff --git a/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/FileHelper.java b/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/FileHelper.javaindex edf165787..7a5524b8d 100644--- a/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/FileHelper.java+++ b/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/FileHelper.java@@ -50,16 +50,7 @@ public class FileHelper {*/@SuppressWarnings("deprecation")public static String getRealPath(Uri uri, CordovaInterface cordova) {- String realPath = null;-- if (Build.VERSION.SDK_INT < 11)- realPath = FileHelper.getRealPathFromURI_BelowAPI11(cordova.getActivity(), uri);-- // SDK >= 11- else- realPath = FileHelper.getRealPathFromURI_API11_And_Above(cordova.getActivity(), uri);-- return realPath;+ return FileHelper.getRealPathFromURI(cordova.getActivity(), uri);}/**@@ -75,11 +66,9 @@ public class FileHelper {}@SuppressLint("NewApi")- public static String getRealPathFromURI_API11_And_Above(final Context context, final Uri uri) {-- final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;+ public static String getRealPathFromURI(final Context context, final Uri uri) {// DocumentProvider- if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {+ if (DocumentsContract.isDocumentUri(context, uri)) {// ExternalStorageProviderif (isExternalStorageDocument(uri)) {diff --git a/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/GalleryPathVO.java b/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/GalleryPathVO.javanew file mode 100644index 000000000..579044327--- /dev/null+++ b/cordova/platforms/android/app/src/main/java/org/apache/cordova/camera/GalleryPathVO.java@@ -0,0 +1,43 @@+/*+ Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+*/+package org.apache.cordova.camera;++public class GalleryPathVO {+ private final String galleryPath;+ private String picturesDirectory;+ private String galleryFileName;++ public GalleryPathVO(String picturesDirectory, String galleryFileName) {+ this.picturesDirectory = picturesDirectory;+ this.galleryFileName = galleryFileName;+ this.galleryPath = this.picturesDirectory + "/" + this.galleryFileName;+ }++ public String getGalleryPath() {+ return galleryPath;+ }++ public String getPicturesDirectory() {+ return picturesDirectory;+ }++ public String getGalleryFileName() {+ return galleryFileName;+ }+}diff --git a/cordova/platforms/android/app/src/main/java/org/apache/cordova/file/LocalFilesystem.java b/cordova/platforms/android/app/src/main/java/org/apache/cordova/file/LocalFilesystem.javaindex 393344f4f..051f99496 100644--- a/cordova/platforms/android/app/src/main/java/org/apache/cordova/file/LocalFilesystem.java+++ b/cordova/platforms/android/app/src/main/java/org/apache/cordova/file/LocalFilesystem.java@@ -272,7 +272,7 @@ public class LocalFilesystem extends Filesystem {}CordovaResourceApi.OpenForReadResult offr = resourceApi.openForRead(srcFs.toNativeUri(srcURL));- resourceApi.copyResource(offr, new FileOutputStream(destFile));+ copyResource(offr, new FileOutputStream(destFile));if (move) {srcFs.removeFileAtLocalURL(srcURL);@@ -470,4 +470,44 @@ public class LocalFilesystem extends Filesystem {File file = new File(path);return file.exists();}++ // This is a copy & paste from CordovaResource API that is required since CordovaResourceApi+ // has a bug pre-4.0.0.+ // TODO: Once [email protected] is released, delete this copy and make the plugin depend on+ // 4.0.0 with an engine tag.+ private static void copyResource(CordovaResourceApi.OpenForReadResult input, OutputStream outputStream) throws IOException {+ try {+ InputStream inputStream = input.inputStream;+ if (inputStream instanceof FileInputStream && outputStream instanceof FileOutputStream) {+ FileChannel inChannel = ((FileInputStream)input.inputStream).getChannel();+ FileChannel outChannel = ((FileOutputStream)outputStream).getChannel();+ long offset = 0;+ long length = input.length;+ if (input.assetFd != null) {+ offset = input.assetFd.getStartOffset();+ }+ // transferFrom()'s 2nd arg is a relative position. Need to set the absolute+ // position first.+ inChannel.position(offset);+ outChannel.transferFrom(inChannel, 0, length);+ } else {+ final int BUFFER_SIZE = 8192;+ byte[] buffer = new byte[BUFFER_SIZE];++ for (;;) {+ int bytesRead = inputStream.read(buffer, 0, BUFFER_SIZE);++ if (bytesRead <= 0) {+ break;+ }+ outputStream.write(buffer, 0, bytesRead);+ }+ }+ } finally {+ input.inputStream.close();+ if (outputStream != null) {+ outputStream.close();+ }+ }+ }}diff --git a/cordova/platforms/android/app/src/main/res/xml/camera_provider_paths.xml b/cordova/platforms/android/app/src/main/res/xml/camera_provider_paths.xmlindex 2db87bdbd..326674847 100644--- a/cordova/platforms/android/app/src/main/res/xml/camera_provider_paths.xml+++ b/cordova/platforms/android/app/src/main/res/xml/camera_provider_paths.xml@@ -17,5 +17,5 @@--><paths xmlns:android="http://schemas.android.com/apk/res/android">- <external-path name="external_files" path="."/>+ <cache-path name="cache_files" path="." /></paths>\ No newline at end of filediff --git a/cordova/platforms/android/app/src/main/res/xml/config.xml b/cordova/platforms/android/app/src/main/res/xml/config.xmlindex 741a78d55..593f7ad88 100644--- a/cordova/platforms/android/app/src/main/res/xml/config.xml+++ b/cordova/platforms/android/app/src/main/res/xml/config.xml@@ -37,9 +37,6 @@<feature name="SocialSharing"><param name="android-package" value="nl.xservices.plugins.SocialSharing" /></feature>- <feature name="Chooser">- <param name="android-package" value="com.cyph.cordova.Chooser" />- </feature><name>TagSpaces</name><description>Offline file organizer and browser with tagging support.diff --git a/cordova/platforms/android/build.gradle b/cordova/platforms/android/build.gradleindex 089660c28..d09805de4 100644--- a/cordova/platforms/android/build.gradle+++ b/cordova/platforms/android/build.gradle@@ -20,10 +20,9 @@buildscript {ext.kotlin_version = '1.3.50'- repositories {- google()- jcenter()- }+ apply from: 'repositories.gradle'+ repositories repos+dependencies {classpath 'com.android.tools.build:gradle:4.0.0'classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"@@ -33,10 +32,8 @@ buildscript {}allprojects {- repositories {- google()- jcenter()- }+ apply from: 'repositories.gradle'+ repositories repos//This replaces project.properties w.r.t. build settingsproject.ext {diff --git a/cordova/platforms/android/cordova/Api.js b/cordova/platforms/android/cordova/Api.jsindex 91690a63e..0c70d3260 100644--- a/cordova/platforms/android/cordova/Api.js+++ b/cordova/platforms/android/cordova/Api.js@@ -24,7 +24,7 @@* This workflow would not have the `package.json` file.*/// Coho updates this line-const VERSION = '9.0.0';+const VERSION = '9.1.0';var path = require('path');@@ -85,6 +85,8 @@ class Api {build: path.join(this.root, 'build'),javaSrc: path.join(appMain, 'java')};++ this._builder = require('./lib/builders/builders').getBuilder(this.root);}/**@@ -161,7 +163,7 @@ class Api {if (plugin.getFrameworks(this.platform).length === 0) return;selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');// This should pick the correct builder, not just get gradle- require('./lib/builders/builders').getBuilder().prepBuildFiles();+ this._builder.prepBuildFiles();}.bind(this))// CB-11022 Return truthy value to prevent running prepare after.then(() => true);@@ -193,7 +195,7 @@ class Api {if (plugin.getFrameworks(this.platform).length === 0) return;selfEvents.emit('verbose', 'Updating build files since android plugin contained <framework>');- require('./lib/builders/builders').getBuilder().prepBuildFiles();+ this._builder.prepBuildFiles();}.bind(this))// CB-11022 Return truthy value to prevent running prepare after.then(() => true);diff --git a/cordova/platforms/android/cordova/lib/Adb.js b/cordova/platforms/android/cordova/lib/Adb.jsindex 042a0c2a3..932626986 100644--- a/cordova/platforms/android/cordova/lib/Adb.js+++ b/cordova/platforms/android/cordova/lib/Adb.js@@ -24,42 +24,40 @@ var CordovaError = require('cordova-common').CordovaError;var Adb = {};-function isDevice (line) {- return line.match(/\w+\tdevice/) && !line.match(/emulator/);-}--function isEmulator (line) {- return line.match(/device/) && line.match(/emulator/);-}-/*** Lists available/connected devices and emulators*- * @param {Object} opts Various options- * @param {Boolean} opts.emulators Specifies whether this method returns- * emulators only- ** @return {Promise<String[]>} list of available/connected* devices/emulators*/-Adb.devices = function (opts) {- return execa('adb', ['devices'], { cwd: os.tmpdir() }).then(({ stdout: output }) => {- return output.split('\n').filter(function (line) {- // Filter out either real devices or emulators, depending on options- return (line && opts && opts.emulators) ? isEmulator(line) : isDevice(line);- }).map(function (line) {- return line.replace(/\tdevice/, '').replace('\r', '');- });- });+Adb.devices = async function () {+ const { stdout } = await execa('adb', ['devices'], { cwd: os.tmpdir() });++ // Split into lines & drop first one (header)+ const rawDeviceLines = stdout.trim().split(/\r?\n/).slice(1);++ return rawDeviceLines+ .map(line => line.split('\t'))++ // We are only interested in fully booted devices & emulators. These+ // have a state of `device`. For a list of all the other possible states+ // see https://github.com/aosp-mirror/platform_system_core/blob/2abdb1eb5b83c8f39874644af576c869815f5c5b/adb/transport.cpp#L1129+ .filter(([, state]) => state === 'device')++ .map(([id]) => id);};-Adb.install = function (target, packagePath, opts) {+Adb.install = function (target, packagePath, { replace = false, execOptions = {} } = {}) {events.emit('verbose', 'Installing apk ' + packagePath + ' on target ' + target + '...');+var args = ['-s', target, 'install'];- if (opts && opts.replace) args.push('-r');- return execa('adb', args.concat(packagePath), { cwd: os.tmpdir() }).then(({ stdout: output }) => {- // 'adb install' seems to always returns no error, even if installation fails- // so we catching output to detect installation failure+ if (replace) args.push('-r');++ const opts = { cwd: os.tmpdir(), ...execOptions };++ return execa('adb', args.concat(packagePath), opts).then(({ stdout: output }) => {+ // adb does not return an error code even if installation fails. Instead it puts a specific+ // message to stdout, so we have to use RegExp matching to detect installation failure.if (output.match(/Failure/)) {if (output.match(/INSTALL_PARSE_FAILED_NO_CERTIFICATES/)) {output += '\n\n' + 'Sign the build using \'-- --keystore\' or \'--buildConfig\'' +@@ -69,7 +67,7 @@ Adb.install = function (target, packagePath, opts) {'\nEither uninstall an app or increment the versionCode.';}- return Promise.reject(new CordovaError('Failed to install apk to device: ' + output));+ throw new CordovaError('Failed to install apk to target: ' + output);}});};diff --git a/cordova/platforms/android/cordova/lib/build.js b/cordova/platforms/android/cordova/lib/build.jsindex e199239db..71b93cc55 100644--- a/cordova/platforms/android/cordova/lib/build.js+++ b/cordova/platforms/android/cordova/lib/build.js@@ -23,10 +23,7 @@ var nopt = require('nopt');var Adb = require('./Adb');-var builders = require('./builders/builders');var events = require('cordova-common').events;-const execa = require('execa');-var CordovaError = require('cordova-common').CordovaError;var PackageType = require('./PackageType');module.exports.parseBuildOptions = parseOpts;@@ -145,7 +142,7 @@ function parseOpts (options, resolvedTarget, projectRoot) {*/module.exports.runClean = function (options) {var opts = parseOpts(options, null, this.root);- var builder = builders.getBuilder();+ var builder = this._builder;return builder.prepEnv(opts).then(function () {return builder.clean(opts);@@ -166,7 +163,7 @@ module.exports.runClean = function (options) {*/module.exports.run = function (options, optResolvedTarget) {var opts = parseOpts(options, optResolvedTarget, this.root);- var builder = builders.getBuilder();+ var builder = this._builder;return builder.prepEnv(opts).then(function () {if (opts.prepEnv) {@@ -196,45 +193,8 @@ module.exports.run = function (options, optResolvedTarget) {* Returns "arm" or "x86".*/module.exports.detectArchitecture = function (target) {- function helper () {- return Adb.shell(target, 'cat /proc/cpuinfo').then(function (output) {- return /intel/i.exec(output) ? 'x86' : 'arm';- });- }- function timeout (ms, err) {- return new Promise((resolve, reject) => {- setTimeout(() => reject(err), ms);- });- }- // It sometimes happens (at least on OS X), that this command will hang forever.- // To fix it, either unplug & replug device, or restart adb server.- return Promise.race([- helper(),- timeout(5000, new CordovaError(- 'Device communication timed out. Try unplugging & replugging the device.'- ))- ]).catch(err => {- if (/timed out/.exec('' + err)) {- // adb kill-server doesn't seem to do the trick.- // Could probably find a x-platform version of killall, but I'm not actually- // sure that this scenario even happens on non-OSX machines.- events.emit('verbose', 'adb timed out while detecting device/emulator architecture. Killing adb and trying again.');- return execa('killall', ['adb']).then(function () {- return helper().then(null, function () {- // The double kill is sadly often necessary, at least on mac.- events.emit('warn', 'adb timed out a second time while detecting device/emulator architecture. Killing adb and trying again.');- return execa('killall', ['adb']).then(function () {- return helper().then(null, function () {- return Promise.reject(new CordovaError('adb timed out a third time while detecting device/emulator architecture. Try unplugging & replugging the device.'));- });- });- });- }, function () {- // For non-killall OS's.- return Promise.reject(err);- });- }- throw err;+ return Adb.shell(target, 'cat /proc/cpuinfo').then(function (output) {+ return /intel/i.exec(output) ? 'x86' : 'arm';});};diff --git a/cordova/platforms/android/cordova/lib/builders/ProjectBuilder.js b/cordova/platforms/android/cordova/lib/builders/ProjectBuilder.jsindex fdf35be45..71cc86d1b 100644--- a/cordova/platforms/android/cordova/lib/builders/ProjectBuilder.js+++ b/cordova/platforms/android/cordova/lib/builders/ProjectBuilder.js@@ -20,10 +20,12 @@var fs = require('fs-extra');var path = require('path');const execa = require('execa');+const glob = require('fast-glob');var events = require('cordova-common').events;var CordovaError = require('cordova-common').CordovaError;var check_reqs = require('../check_reqs');var PackageType = require('../PackageType');+const { compareByAll } = require('../utils');const { createEditor } = require('properties-parser');const MARKER = 'YOUR CHANGES WILL BE ERASED!';@@ -32,83 +34,46 @@ const TEMPLATE ='# This file is automatically generated.\n' +'# Do not modify this file -- ' + MARKER + '\n';-const archSpecificRegex = /-x86|-arm/;-const unsignedBuildRegex = /-unsigned/;+const isPathArchSpecific = p => /-x86|-arm/.test(path.basename(p));-const fileSorter = (filePathA, filePathB) => {- const archSpecificA = archSpecificRegex.test(filePathA);- const archSpecificB = archSpecificRegex.test(filePathB);+const outputFileComparator = compareByAll([+ // Sort arch specific builds after generic ones+ isPathArchSpecific,- // If they are not equal, then sort by specific archs after generic ones- if (archSpecificA !== archSpecificB) {- return archSpecificA < archSpecificB ? -1 : 1;- }-- // Otherwise, move onto the next sort item, which is by sorting unsigned bulds after signed ones- const unsignedA = unsignedBuildRegex.test(filePathA);- const unsignedB = unsignedBuildRegex.test(filePathB);-- if (unsignedA !== unsignedB) {- return unsignedA < unsignedB ? -1 : 1;- }-- // Then, sort by modification time, latest first- const modTimeA = fs.statSync(filePathA).mtime.getTime();- const modTimeB = fs.statSync(filePathB).mtime.getTime();-- if (modTimeA !== modTimeB) {- return modTimeA < modTimeB ? 1 : -1;- }+ // Sort unsigned builds after signed ones+ filePath => /-unsigned/.test(path.basename(filePath)),- // Finally, if all above is the same, sort by file name length, ascending- return filePathB.length < filePathA.length ? -1 : 1;-};+ // Sort by file modification time, latest first+ filePath => -fs.statSync(filePath).mtime.getTime(),-/**- * If the provided directory does not exist or extension is missing, return an empty array.- * If the director exists, loop the directories and collect list of files matching the extension.- *- * @param {String} dir Directory to scan- * @param {String} extension- */-function recursivelyFindFiles (dir, extension) {- if (!fs.existsSync(dir) || !extension) return [];-- const files = fs.readdirSync(dir, { withFileTypes: true })- .map(entry => {- const item = path.resolve(dir, entry.name);-- if (entry.isDirectory()) return recursivelyFindFiles(item, extension);- if (path.extname(entry.name) === `.${extension}`) return item;- return false;- });-- return Array.prototype.concat(...files)- .filter(file => file !== false);-}+ // Sort by file name length, ascending+ filePath => filePath.length+]);/**- * @param {String} dir- * @param {String} build_type- * @param {String} arch- * @param {String} extension+ * @param {'apk' | 'aab'} bundleType+ * @param {'debug' | 'release'} buildType+ * @param {{arch?: string}} options*/-function findOutputFilesHelper (dir, build_type, arch, extension) {- let files = recursivelyFindFiles(path.resolve(dir, build_type), extension);+function findOutputFiles (bundleType, buildType, { arch } = {}) {+ let files = glob.sync(`**/*.${bundleType}`, {+ absolute: true,+ cwd: path.resolve(this[`${bundleType}Dir`], buildType)+ }).map(path.normalize);if (files.length === 0) return files;// Assume arch-specific build if newest apk has -x86 or -arm.- const archSpecific = !!/-x86|-arm/.exec(path.basename(files[0]));+ const archSpecific = isPathArchSpecific(files[0]);// And show only arch-specific ones (or non-arch-specific)- files = files.filter(p => !!/-x86|-arm/.exec(path.basename(p)) === archSpecific);+ files = files.filter(p => isPathArchSpecific(p) === archSpecific);if (archSpecific && files.length > 1 && arch) {- files = files.filter(p => path.basename(p).indexOf('-' + arch) !== -1);+ files = files.filter(p => path.basename(p).includes('-' + arch));}- return files;+ return files.sort(outputFileComparator);}class ProjectBuilder {@@ -330,7 +295,7 @@ class ProjectBuilder {var wrapper = path.join(this.root, 'gradlew');var args = this.getArgs(opts.buildType === 'debug' ? 'debug' : 'release', opts);- return execa(wrapper, args, { stdio: 'inherit' })+ return execa(wrapper, args, { stdio: 'inherit', cwd: path.resolve(this.root) }).catch(function (error) {if (error.toString().indexOf('failed to find target with hash string') >= 0) {return check_reqs.check_android_target(error).then(function () {@@ -346,7 +311,7 @@ class ProjectBuilder {clean (opts) {const wrapper = path.join(this.root, 'gradlew');const args = this.getArgs('clean', opts);- return execa(wrapper, args, { stdio: 'inherit' })+ return execa(wrapper, args, { stdio: 'inherit', cwd: path.resolve(this.root) }).then(() => {fs.removeSync(path.join(this.root, 'out'));@@ -362,11 +327,11 @@ class ProjectBuilder {}findOutputApks (build_type, arch) {- return findOutputFilesHelper(this.apkDir, build_type, arch, 'apk').sort(fileSorter);+ return findOutputFiles.call(this, 'apk', build_type, { arch });}findOutputBundles (build_type) {- return findOutputFilesHelper(this.aabDir, build_type, false, 'aab').sort(fileSorter);+ return findOutputFiles.call(this, 'aab', build_type);}fetchBuildResults (build_type, arch) {diff --git a/cordova/platforms/android/cordova/lib/check_reqs.js b/cordova/platforms/android/cordova/lib/check_reqs.jsindex 21d90f769..82827ac05 100644--- a/cordova/platforms/android/cordova/lib/check_reqs.js+++ b/cordova/platforms/android/cordova/lib/check_reqs.js@@ -20,43 +20,20 @@const execa = require('execa');var path = require('path');var fs = require('fs-extra');-var os = require('os');-var which = require('which');+const { forgivingWhichSync, isWindows, isDarwin } = require('./utils');+const java = require('./env/java');var REPO_ROOT = path.join(__dirname, '..', '..', '..', '..');var PROJECT_ROOT = path.join(__dirname, '..', '..');const { CordovaError, ConfigParser, events } = require('cordova-common');var android_sdk = require('./android_sdk');const { createEditor } = require('properties-parser');+const semver = require('semver');-function forgivingWhichSync (cmd) {- const whichResult = which.sync(cmd, { nothrow: true });-- // On null, returns empty string to maintain backwards compatibility- // realpathSync follows symlinks- return whichResult === null ? '' : fs.realpathSync(whichResult);-}--function getJDKDirectory (directory) {- const p = path.resolve(directory, 'java');- if (fs.existsSync(p)) {- const directories = fs.readdirSync(p);- for (let i = 0; i < directories.length; i++) {- const dir = directories[i];- if (/^(jdk)+./.test(dir)) {- return path.resolve(directory, 'java', dir);- }- }- }- return null;-}--module.exports.isWindows = function () {- return (os.platform() === 'win32');-};+const EXPECTED_JAVA_VERSION = '1.8.x';-module.exports.isDarwin = function () {- return (os.platform() === 'darwin');-};+// Re-exporting these for backwards compatibility and for unit testing.+// TODO: Remove uses and use the ./utils module directly.+Object.assign(module.exports, { isWindows, isDarwin });/*** @description Get valid target from framework/project.properties if run from this repo@@ -98,18 +75,6 @@ module.exports.get_target = function () {return target;};-// Returns a promise. Called only by build and clean commands.-module.exports.check_ant = function () {- return execa('ant', ['-version']).then(({ stdout: output }) => {- // Parse Ant version from command output- return /version ((?:\d+\.)+(?:\d+))/i.exec(output)[1];- }).catch(function (err) {- if (err) {- throw new CordovaError('Failed to run `ant -version`. Make sure you have `ant` on your $PATH.');- }- });-};-module.exports.get_gradle_wrapper = function () {var androidStudioPath;var i = 0;@@ -168,75 +133,22 @@ module.exports.check_gradle = function () {'in your path, or install Android Studio'));};-// Returns a promise.-module.exports.check_java = function () {- var javacPath = forgivingWhichSync('javac');- var hasJavaHome = !!process.env.JAVA_HOME;- return Promise.resolve().then(function () {- if (hasJavaHome) {- // Windows java installer doesn't add javac to PATH, nor set JAVA_HOME (ugh).- if (!javacPath) {- process.env.PATH += path.delimiter + path.join(process.env.JAVA_HOME, 'bin');- }- } else {- if (javacPath) {- // OS X has a command for finding JAVA_HOME.- var find_java = '/usr/libexec/java_home';- var default_java_error_msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting it manually.';- if (fs.existsSync(find_java)) {- return execa(find_java).then(({ stdout }) => {- process.env.JAVA_HOME = stdout;- }).catch(function (err) {- if (err) {- throw new CordovaError(default_java_error_msg);- }- });- } else {- // See if we can derive it from javac's location.- var maybeJavaHome = path.dirname(path.dirname(javacPath));- if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {- process.env.JAVA_HOME = maybeJavaHome;- } else {- throw new CordovaError(default_java_error_msg);- }- }- } else if (module.exports.isWindows()) {- const programFilesEnv = path.resolve(process.env.ProgramFiles);- const programFiles = 'C:\\Program Files\\';- const programFilesx86 = 'C:\\Program Files (x86)\\';-- let firstJdkDir =- getJDKDirectory(programFilesEnv) ||- getJDKDirectory(programFiles) ||- getJDKDirectory(programFilesx86);-- if (firstJdkDir) {- firstJdkDir = firstJdkDir.replace(/\//g, path.sep);- if (!javacPath) {- process.env.PATH += path.delimiter + path.join(firstJdkDir, 'bin');- }- process.env.JAVA_HOME = firstJdkDir;- }- }- }- }).then(function () {- return execa('javac', ['-version'], { all: true })- .then(({ all: output }) => {- // Java <= 8 writes version info to stderr, Java >= 9 to stdout- const match = /javac\s+([\d.]+)/i.exec(output);- return match && match[1];- }, () => {- var msg =- 'Failed to run "javac -version", make sure that you have a JDK version 8 installed.\n' +- 'You can get it from the following location:\n' +- 'https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html';- if (process.env.JAVA_HOME) {- msg += '\n\n';- msg += 'Your JAVA_HOME is invalid: ' + process.env.JAVA_HOME;- }- throw new CordovaError(msg);- });- });+/**+ * Checks for the java installation and correct version+ *+ * Despite the name, it should return the Java version value, it's used by the Cordova CLI.+ */+module.exports.check_java = async function () {+ const javaVersion = await java.getVersion();++ if (!semver.satisfies(javaVersion.version, EXPECTED_JAVA_VERSION)) {+ throw new CordovaError(+ `Requirements check failed for JDK ${EXPECTED_JAVA_VERSION}! Detected version: ${javaVersion.version}\n` ++ 'Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.'+ );+ }++ return javaVersion;};// Returns a promise.@@ -412,13 +324,6 @@ module.exports.run = function () {return Promise.all([this.check_java(), this.check_android()]).then(function (values) {console.log('Using Android SDK: ' + process.env.ANDROID_SDK_ROOT);- if (!String(values[0]).startsWith('1.8.')) {- throw new CordovaError(- 'Requirements check failed for JDK 8 (\'1.8.*\')! Detected version: ' + values[0] + '\n' +- 'Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.'- );- }-if (!values[1]) {throw new CordovaError('Requirements check failed for Android SDK! Android SDK was not detected.');}diff --git a/cordova/platforms/android/cordova/lib/device.js b/cordova/platforms/android/cordova/lib/device.jsdeleted file mode 100644index 3bb95c90a..000000000--- a/cordova/platforms/android/cordova/lib/device.js+++ /dev/null@@ -1,109 +0,0 @@-/*- Licensed to the Apache Software Foundation (ASF) under one- or more contributor license agreements. See the NOTICE file- distributed with this work for additional information- regarding copyright ownership. The ASF licenses this file- to you under the Apache License, Version 2.0 (the- "License"); you may not use this file except in compliance- with the License. You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing,- software distributed under the License is distributed on an- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY- KIND, either express or implied. See the License for the- specific language governing permissions and limitations- under the License.-*/--const execa = require('execa');-var build = require('./build');-var path = require('path');-var Adb = require('./Adb');-var AndroidManifest = require('./AndroidManifest');-var CordovaError = require('cordova-common').CordovaError;-var events = require('cordova-common').events;--/**- * Returns a promise for the list of the device ID's found- * @param lookHarder When true, try restarting adb if no devices are found.- */-module.exports.list = function (lookHarder) {- return Adb.devices().then(function (list) {- if (list.length === 0 && lookHarder) {- // adb kill-server doesn't seem to do the trick.- // Could probably find a x-platform version of killall, but I'm not actually- // sure that this scenario even happens on non-OSX machines.- return execa('killall', ['adb']).then(function () {- events.emit('verbose', 'Restarting adb to see if more devices are detected.');- return Adb.devices();- }, function () {- // For non-killall OS's.- return list;- });- }- return list;- });-};--module.exports.resolveTarget = function (target) {- return this.list(true).then(function (device_list) {- if (!device_list || !device_list.length) {- return Promise.reject(new CordovaError('Failed to deploy to device, no devices found.'));- }- // default device- target = target || device_list[0];-- if (device_list.indexOf(target) < 0) {- return Promise.reject(new CordovaError('ERROR: Unable to find target \'' + target + '\'.'));- }-- return build.detectArchitecture(target).then(function (arch) {- return { target: target, arch: arch, isEmulator: false };- });- });-};--/*- * Installs a previously built application on the device- * and launches it.- * Returns a promise.- */-module.exports.install = function (target, buildResults) {- return Promise.resolve().then(function () {- if (target && typeof target === 'object') {- return target;- }- return module.exports.resolveTarget(target);- }).then(function (resolvedTarget) {- var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch);- var manifest = new AndroidManifest(path.join(__dirname, '../../app/src/main/AndroidManifest.xml'));- var pkgName = manifest.getPackageId();- var launchName = pkgName + '/.' + manifest.getActivity().getName();- events.emit('log', 'Using apk: ' + apk_path);- events.emit('log', 'Package name: ' + pkgName);-- return Adb.install(resolvedTarget.target, apk_path, { replace: true }).catch(function (error) {- // CB-9557 CB-10157 only uninstall and reinstall app if the one that- // is already installed on device was signed w/different certificate- if (!/INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES/.test(error.toString())) { throw error; }-- events.emit('warn', 'Uninstalling app from device and reinstalling it again because the ' +- 'installed app already signed with different key');-- // This promise is always resolved, even if 'adb uninstall' fails to uninstall app- // or the app doesn't installed at all, so no error catching needed.- return Adb.uninstall(resolvedTarget.target, pkgName).then(function () {- return Adb.install(resolvedTarget.target, apk_path, { replace: true });- });- }).then(function () {- // unlock screen- return Adb.shell(resolvedTarget.target, 'input keyevent 82');- }).then(function () {- return Adb.start(resolvedTarget.target, launchName);- }).then(function () {- events.emit('log', 'LAUNCH SUCCESS');- });- });-};diff --git a/cordova/platforms/android/cordova/lib/emulator.js b/cordova/platforms/android/cordova/lib/emulator.jsindex 928ad44d5..7a5fbd170 100644--- a/cordova/platforms/android/cordova/lib/emulator.js+++ b/cordova/platforms/android/cordova/lib/emulator.js@@ -20,25 +20,17 @@const execa = require('execa');const fs = require('fs-extra');var android_versions = require('android-versions');-var retry = require('./retry');-var build = require('./build');var path = require('path');var Adb = require('./Adb');-var AndroidManifest = require('./AndroidManifest');var events = require('cordova-common').events;var CordovaError = require('cordova-common').CordovaError;var android_sdk = require('./android_sdk');var check_reqs = require('./check_reqs');var which = require('which');-var os = require('os');// constantsconst ONE_SECOND = 1000; // in milliseconds-const ONE_MINUTE = 60 * ONE_SECOND; // in milliseconds-const INSTALL_COMMAND_TIMEOUT = 5 * ONE_MINUTE; // in milliseconds-const NUM_INSTALL_RETRIES = 3;const CHECK_BOOTED_INTERVAL = 3 * ONE_SECOND; // in milliseconds-const EXEC_KILL_SIGNAL = 'SIGKILL';function forgivingWhichSync (cmd) {const whichResult = which.sync(cmd, { nothrow: true });@@ -215,24 +207,9 @@ module.exports.best_image = function () {});};-// Returns a promise.-module.exports.list_started = function () {- return Adb.devices({ emulators: true });-};--// Returns a promise.-// TODO: we should remove this, there's a more robust method under android_sdk.js-module.exports.list_targets = function () {- return execa('android', ['list', 'targets'], { cwd: os.tmpdir() }).then(({ stdout: output }) => {- var target_out = output.split('\n');- var targets = [];- for (var i = target_out.length; i >= 0; i--) {- if (target_out[i].match(/id:/)) {- targets.push(targets[i].split(' ')[1]);- }- }- return targets;- });+exports.list_started = async () => {+ return (await Adb.devices())+ .filter(id => id.startsWith('emulator-'));};/*@@ -371,147 +348,3 @@ module.exports.wait_for_boot = function (emulator_id, time_remaining) {}});};--/*- * Create avd- * TODO : Enter the stdin input required to complete the creation of an avd.- * Returns a promise.- */-module.exports.create_image = function (name, target) {- console.log('Creating new avd named ' + name);- if (target) {- return execa('android', ['create', 'avd', '--name', name, '--target', target]).then(null, function (error) {- console.error('ERROR : Failed to create emulator image : ');- console.error(' Do you have the latest android targets including ' + target + '?');- console.error(error.message);- });- } else {- console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');- // TODO: there's a more robust method for finding targets in android_sdk.js- return execa('android', ['create', 'avd', '--name', name, '--target', this.list_targets()[0]]).then(function () {- // TODO: This seems like another error case, even though it always happens.- console.error('ERROR : Unable to create an avd emulator, no targets found.');- console.error('Ensure you have targets available by running the "android" command');- return Promise.reject(new CordovaError());- }, function (error) {- console.error('ERROR : Failed to create emulator image : ');- console.error(error.message);- });- }-};--module.exports.resolveTarget = function (target) {- return this.list_started().then(function (emulator_list) {- if (emulator_list.length < 1) {- return Promise.reject(new CordovaError('No running Android emulators found, please start an emulator before deploying your project.'));- }-- // default emulator- target = target || emulator_list[0];- if (emulator_list.indexOf(target) < 0) {- return Promise.reject(new CordovaError('Unable to find target \'' + target + '\'. Failed to deploy to emulator.'));- }-- return build.detectArchitecture(target).then(function (arch) {- return { target: target, arch: arch, isEmulator: true };- });- });-};--/*- * Installs a previously built application on the emulator and launches it.- * If no target is specified, then it picks one.- * If no started emulators are found, error out.- * Returns a promise.- */-module.exports.install = function (givenTarget, buildResults) {- var target;- // We need to find the proper path to the Android Manifest- const manifestPath = path.join(__dirname, '..', '..', 'app', 'src', 'main', 'AndroidManifest.xml');- const manifest = new AndroidManifest(manifestPath);- const pkgName = manifest.getPackageId();-- // resolve the target emulator- return Promise.resolve().then(function () {- if (givenTarget && typeof givenTarget === 'object') {- return givenTarget;- } else {- return module.exports.resolveTarget(givenTarget);- }-- // set the resolved target- }).then(function (resolvedTarget) {- target = resolvedTarget;-- // install the app- }).then(function () {- // This promise is always resolved, even if 'adb uninstall' fails to uninstall app- // or the app doesn't installed at all, so no error catching needed.- return Promise.resolve().then(function () {- var apk_path = build.findBestApkForArchitecture(buildResults, target.arch);- var execOptions = {- cwd: os.tmpdir(),- timeout: INSTALL_COMMAND_TIMEOUT, // in milliseconds- killSignal: EXEC_KILL_SIGNAL- };-- events.emit('log', 'Using apk: ' + apk_path);- events.emit('log', 'Package name: ' + pkgName);- events.emit('verbose', 'Installing app on emulator...');-- // A special function to call adb install in specific environment w/ specific options.- // Introduced as a part of fix for http://issues.apache.org/jira/browse/CB-9119- // to workaround sporadic emulator hangs- function adbInstallWithOptions (target, apk, opts) {- events.emit('verbose', 'Installing apk ' + apk + ' on ' + target + '...');-- const args = ['-s', target, 'install', '-r', apk];- return execa('adb', args, opts).then(({ stdout }) => {- // adb does not return an error code even if installation fails. Instead it puts a specific- // message to stdout, so we have to use RegExp matching to detect installation failure.- if (/Failure/.test(stdout)) {- if (stdout.match(/INSTALL_PARSE_FAILED_NO_CERTIFICATES/)) {- stdout += 'Sign the build using \'-- --keystore\' or \'--buildConfig\'' +- ' or sign and deploy the unsigned apk manually using Android tools.';- } else if (stdout.match(/INSTALL_FAILED_VERSION_DOWNGRADE/)) {- stdout += 'You\'re trying to install apk with a lower versionCode that is already installed.' +- '\nEither uninstall an app or increment the versionCode.';- }-- throw new CordovaError('Failed to install apk to emulator: ' + stdout);- }- });- }-- function installPromise () {- return adbInstallWithOptions(target.target, apk_path, execOptions).catch(function (error) {- // CB-9557 CB-10157 only uninstall and reinstall app if the one that- // is already installed on device was signed w/different certificate- if (!/INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES/.test(error.toString())) { throw error; }-- events.emit('warn', 'Uninstalling app from device and reinstalling it because the ' +- 'currently installed app was signed with different key');-- // This promise is always resolved, even if 'adb uninstall' fails to uninstall app- // or the app doesn't installed at all, so no error catching needed.- return Adb.uninstall(target.target, pkgName).then(function () {- return adbInstallWithOptions(target.target, apk_path, execOptions);- });- });- }-- return retry.retryPromise(NUM_INSTALL_RETRIES, installPromise).then(function (output) {- events.emit('log', 'INSTALL SUCCESS');- });- });- // unlock screen- }).then(function () {- events.emit('verbose', 'Unlocking screen...');- return Adb.shell(target.target, 'input keyevent 82');- }).then(function () {- Adb.start(target.target, pkgName + '/.' + manifest.getActivity().getName());- // report success or failure- }).then(function (output) {- events.emit('log', 'LAUNCH SUCCESS');- });-};diff --git a/cordova/platforms/android/cordova/lib/env/java.js b/cordova/platforms/android/cordova/lib/env/java.jsnew file mode 100644index 000000000..6eed6f600--- /dev/null+++ b/cordova/platforms/android/cordova/lib/env/java.js@@ -0,0 +1,123 @@+/*+ Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+*/++const execa = require('execa');+const fs = require('fs-extra');+const path = require('path');+const glob = require('fast-glob');+const { CordovaError, events } = require('cordova-common');+const utils = require('../utils');+const semver = require('semver');++/**+ * Will be set to true on successful ensureness.+ * If true, skips the expensive java checks.+ */+let javaIsEnsured = false;++const java = {+ /**+ * Gets the version from the javac executable.+ *+ * @returns {semver.SemVer}+ */+ getVersion: async () => {+ await java._ensure(process.env);++ // Java <= 8 writes version info to stderr, Java >= 9 to stdout+ let version = null;+ try {+ version = (await execa('javac', ['-version'], { all: true })).all;+ } catch (ex) {+ events.emit('verbose', ex.shortMessage);++ let msg =+ 'Failed to run "javac -version", make sure that you have a JDK version 8 installed.\n' ++ 'You can get it from the following location:\n' ++ 'https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html';+ if (process.env.JAVA_HOME) {+ msg += '\n\n';+ msg += 'Your JAVA_HOME is invalid: ' + process.env.JAVA_HOME;+ }+ throw new CordovaError(msg);+ }++ return semver.coerce(version);+ },++ /**+ * Ensures that Java is installed. Will throw exception if not.+ * Will set JAVA_HOME and PATH environment variables.+ *+ * This function becomes a no-op if already ran previously.+ */+ _ensure: async (environment) => {+ if (javaIsEnsured) {+ return;+ }++ const javacPath = utils.forgivingWhichSync('javac');+ const hasJavaHome = !!environment.JAVA_HOME;+ if (hasJavaHome) {+ // Windows java installer doesn't add javac to PATH, nor set JAVA_HOME (ugh).+ if (!javacPath) {+ environment.PATH += path.delimiter + path.join(environment.JAVA_HOME, 'bin');+ }+ } else {+ if (javacPath) {+ // OS X has a command for finding JAVA_HOME.+ const find_java = '/usr/libexec/java_home';+ const default_java_error_msg = 'Failed to find \'JAVA_HOME\' environment variable. Try setting it manually.';+ if (fs.existsSync(find_java)) {+ try {+ environment.JAVA_HOME = (await execa(find_java)).stdout;+ } catch (ex) {+ events.emit('verbose', ex.shortMessage);+ throw new CordovaError(default_java_error_msg);+ }+ } else {+ // See if we can derive it from javac's location.+ var maybeJavaHome = path.dirname(path.dirname(javacPath));+ if (fs.existsSync(path.join(maybeJavaHome, 'lib', 'tools.jar'))) {+ environment.JAVA_HOME = maybeJavaHome;+ } else {+ throw new CordovaError(default_java_error_msg);+ }+ }+ } else if (utils.isWindows()) {+ const baseDirs = [environment.ProgramFiles, environment['ProgramFiles(x86)']];+ const globOpts = { absolute: true, onlyDirectories: true };+ const flatMap = (arr, f) => [].concat(...arr.map(f));+ const jdkDir = flatMap(baseDirs, cwd => {+ return glob.sync('java/jdk*', { cwd, ...globOpts });+ }+ )[0];++ if (jdkDir) {+ environment.PATH += path.delimiter + path.join(jdkDir, 'bin');+ environment.JAVA_HOME = path.normalize(jdkDir);+ }+ }+ }++ javaIsEnsured = true;+ }+};++module.exports = java;diff --git a/cordova/platforms/android/cordova/lib/install-device b/cordova/platforms/android/cordova/lib/install-deviceindex 03873883e..1340a4d52 100755--- a/cordova/platforms/android/cordova/lib/install-device+++ b/cordova/platforms/android/cordova/lib/install-device@@ -19,24 +19,21 @@under the License.*/-var device = require('./device');+const { resolve, install } = require('./target');+var args = process.argv;+const targetSpec = { type: 'device' };if (args.length > 2) {- var install_target;if (args[2].substring(0, 9) === '--target=') {- install_target = args[2].substring(9, args[2].length);- device.install(install_target).catch(function (err) {- console.error('ERROR: ' + err);- process.exit(2);- });+ targetSpec.id = args[2].substring(9, args[2].length);} else {console.error('ERROR : argument \'' + args[2] + '\' not recognized.');process.exit(2);}-} else {- device.install().catch(function (err) {- console.error('ERROR: ' + err);- process.exit(2);- });}++resolve(targetSpec).then(install).catch(err => {+ console.error('ERROR: ' + err);+ process.exit(2);+});diff --git a/cordova/platforms/android/cordova/lib/install-emulator b/cordova/platforms/android/cordova/lib/install-emulatorindex 2d46dbe93..f73cd050b 100755--- a/cordova/platforms/android/cordova/lib/install-emulator+++ b/cordova/platforms/android/cordova/lib/install-emulator@@ -19,20 +19,21 @@under the License.*/-var emulator = require('./emulator');+const { resolve, install } = require('./target');+var args = process.argv;+const targetSpec = { type: 'emulator' };-var install_target;if (args.length > 2) {if (args[2].substring(0, 9) === '--target=') {- install_target = args[2].substring(9, args[2].length);+ targetSpec.id = args[2].substring(9, args[2].length);} else {console.error('ERROR : argument \'' + args[2] + '\' not recognized.');process.exit(2);}}-emulator.install(install_target).catch(function (err) {+resolve(targetSpec).then(install).catch(err => {console.error('ERROR: ' + err);process.exit(2);});diff --git a/cordova/platforms/android/cordova/lib/list-devices b/cordova/platforms/android/cordova/lib/list-devicesindex 339c6658d..ed8e111f3 100755--- a/cordova/platforms/android/cordova/lib/list-devices+++ b/cordova/platforms/android/cordova/lib/list-devices@@ -19,14 +19,16 @@under the License.*/-var devices = require('./device');+const { list } = require('./target');// Usage support for when args are givenrequire('./check_reqs').check_android().then(function () {- devices.list().then(function (device_list) {- device_list && device_list.forEach(function (dev) {- console.log(dev);- });+ list().then(targets => {+ const deviceIds = targets+ .filter(({ type }) => type === 'device')+ .map(({ id }) => id);++ console.log(deviceIds.join('\n'));}, function (err) {console.error('ERROR: ' + err);process.exit(2);diff --git a/cordova/platforms/android/cordova/lib/pluginHandlers.js b/cordova/platforms/android/cordova/lib/pluginHandlers.jsindex 99e4bac72..617c30ea1 100644--- a/cordova/platforms/android/cordova/lib/pluginHandlers.js+++ b/cordova/platforms/android/cordova/lib/pluginHandlers.js@@ -16,6 +16,7 @@var fs = require('fs-extra');var path = require('path');+var isPathInside = require('is-path-inside');var events = require('cordova-common').events;var CordovaError = require('cordova-common').CordovaError;@@ -209,12 +210,12 @@ function copyFile (plugin_dir, src, project_dir, dest, link) {// check that src path is inside plugin directoryvar real_path = fs.realpathSync(src);var real_plugin_path = fs.realpathSync(plugin_dir);- if (real_path.indexOf(real_plugin_path) !== 0) { throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"'); }+ if (!isPathInside(real_path, real_plugin_path)) { throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"'); }dest = path.resolve(project_dir, dest);// check that dest path is located in project directory- if (dest.indexOf(project_dir) !== 0) { throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project'); }+ if (!isPathInside(dest, project_dir)) { throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project'); }fs.ensureDirSync(path.dirname(dest));if (link) {diff --git a/cordova/platforms/android/cordova/lib/prepare.js b/cordova/platforms/android/cordova/lib/prepare.jsindex 6e8e92fe6..17cbf6f2e 100644--- a/cordova/platforms/android/cordova/lib/prepare.js+++ b/cordova/platforms/android/cordova/lib/prepare.js@@ -20,6 +20,7 @@var fs = require('fs-extra');var path = require('path');const nopt = require('nopt');+const glob = require('fast-glob');var events = require('cordova-common').events;var AndroidManifest = require('./AndroidManifest');var checkReqs = require('./check_reqs');@@ -237,9 +238,9 @@ function updateProjectAccordingTo (platformConfig, locations) {// Java file paths shouldn't be hard codedconst javaDirectory = path.join(locations.javaSrc, manifestId.replace(/\./g, '/'));- const javaPattern = /\.java$/;- const java_files = utils.scanDirectory(javaDirectory, javaPattern, true).filter(function (f) {- return utils.grep(f, /extends\s+CordovaActivity/g) !== null;+ const java_files = glob.sync('**/*.java', { cwd: javaDirectory, absolute: true }).filter(f => {+ const contents = fs.readFileSync(f, 'utf-8');+ return /extends\s+CordovaActivity/.test(contents);});if (java_files.length === 0) {@@ -301,11 +302,12 @@ function default_versionCode (version) {}function getImageResourcePath (resourcesDir, type, density, name, sourceName) {- if (/\.9\.png$/.test(sourceName)) {- name = name.replace(/\.png$/, '.9.png');- }- var resourcePath = path.join(resourcesDir, (density ? type + '-' + density : type), name);- return resourcePath;+ // Use same extension as source with special case for 9-Patch files+ const ext = sourceName.endsWith('.9.png')+ ? '.9.png' : path.extname(sourceName).toLowerCase();++ const subDir = density ? `${type}-${density}` : type;+ return path.join(resourcesDir, subDir, name + ext);}function getAdaptiveImageResourcePath (resourcesDir, type, density, name, sourceName) {@@ -316,6 +318,15 @@ function getAdaptiveImageResourcePath (resourcesDir, type, density, name, sourcereturn resourcePath;}+function makeSplashCleanupMap (projectRoot, resourcesDir) {+ // Build an initial resource map that deletes all existing splash screens+ const existingSplashPaths = glob.sync(+ `${resourcesDir.replace(/\\/g, '/')}/drawable-*/screen.{png,9.png,webp,jpg,jpeg}`,+ { cwd: projectRoot }+ );+ return makeCleanResourceMap(existingSplashPaths);+}+function updateSplashes (cordovaProject, platformResourcesDir) {var resources = cordovaProject.projectConfig.getSplashScreens('android');@@ -325,7 +336,8 @@ function updateSplashes (cordovaProject, platformResourcesDir) {return;}- var resourceMap = mapImageResources(cordovaProject.root, platformResourcesDir, 'drawable', 'screen.png');+ // Build an initial resource map that deletes all existing splash screens+ const resourceMap = makeSplashCleanupMap(cordovaProject.root, platformResourcesDir);var hadMdpi = false;resources.forEach(function (resource) {@@ -336,14 +348,14 @@ function updateSplashes (cordovaProject, platformResourcesDir) {hadMdpi = true;}var targetPath = getImageResourcePath(- platformResourcesDir, 'drawable', resource.density, 'screen.png', path.basename(resource.src));+ platformResourcesDir, 'drawable', resource.density, 'screen', path.basename(resource.src));resourceMap[targetPath] = resource.src;});// There's no "default" drawable, so assume default == mdpi.if (!hadMdpi && resources.defaultResource) {var targetPath = getImageResourcePath(- platformResourcesDir, 'drawable', 'mdpi', 'screen.png', path.basename(resources.defaultResource.src));+ platformResourcesDir, 'drawable', 'mdpi', 'screen', path.basename(resources.defaultResource.src));resourceMap[targetPath] = resources.defaultResource.src;}@@ -355,7 +367,8 @@ function updateSplashes (cordovaProject, platformResourcesDir) {function cleanSplashes (projectRoot, projectConfig, platformResourcesDir) {var resources = projectConfig.getSplashScreens('android');if (resources.length > 0) {- var resourceMap = mapImageResources(projectRoot, platformResourcesDir, 'drawable', 'screen.png');+ const resourceMap = makeSplashCleanupMap(projectRoot, platformResourcesDir);+events.emit('verbose', 'Cleaning splash screens at ' + platformResourcesDir);// No source paths are specified in the map, so updatePaths() will delete the target files.@@ -545,13 +558,13 @@ function updateIconResourceForLegacy (preparedIcons, resourceMap, platformResour// The source paths for icons and splashes are relative to// project's config.xml location, so we use it as base path.for (var density in android_icons) {- var targetPath = getImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher.png', path.basename(android_icons[density].src));+ var targetPath = getImageResourcePath(platformResourcesDir, 'mipmap', density, 'ic_launcher', path.basename(android_icons[density].src));resourceMap[targetPath] = android_icons[density].src;}// There's no "default" drawable, so assume default == mdpi.if (default_icon && !android_icons.mdpi) {- var defaultTargetPath = getImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher.png', path.basename(default_icon.src));+ var defaultTargetPath = getImageResourcePath(platformResourcesDir, 'mipmap', 'mdpi', 'ic_launcher', path.basename(default_icon.src));resourceMap[defaultTargetPath] = default_icon.src;}@@ -664,14 +677,24 @@ function cleanIcons (projectRoot, projectConfig, platformResourcesDir) {*/function mapImageResources (rootDir, subDir, type, resourceName) {const pathMap = {};- const pattern = new RegExp(type + '+-.+');- utils.scanDirectory(path.join(rootDir, subDir), pattern).forEach(function (drawableFolder) {- const imagePath = path.join(subDir, path.basename(drawableFolder), resourceName);+ const globOptions = { cwd: path.join(rootDir, subDir), onlyDirectories: true };+ glob.sync(type + '-*', globOptions).forEach(drawableFolder => {+ const imagePath = path.join(subDir, drawableFolder, resourceName);pathMap[imagePath] = null;});return pathMap;}+/** Returns resource map that deletes all given paths */+function makeCleanResourceMap (resourcePaths) {+ const pathMap = {};+ resourcePaths.map(path.normalize)+ .forEach(resourcePath => {+ pathMap[resourcePath] = null;+ });+ return pathMap;+}+function updateFileResources (cordovaProject, platformDir) {var files = cordovaProject.projectConfig.getFileResources('android');diff --git a/cordova/platforms/android/cordova/lib/retry.js b/cordova/platforms/android/cordova/lib/retry.jsindex 6ce8e818b..6806422af 100644--- a/cordova/platforms/android/cordova/lib/retry.js+++ b/cordova/platforms/android/cordova/lib/retry.js@@ -21,7 +21,7 @@var events = require('cordova-common').events;-/*+/*** Retry a promise-returning function a number of times, propagating its* results on success or throwing its error on a failed final attempt.*@@ -31,31 +31,13 @@ var events = require('cordova-common').events;** @returns {Promise}*/-module.exports.retryPromise = function (attemptsLeft, promiseFunction) {- // NOTE:- // get all trailing arguments, by skipping the first two (attemptsLeft and- // promiseFunction) because they shouldn't get passed to promiseFunction- var promiseFunctionArguments = Array.prototype.slice.call(arguments, 2);-- return promiseFunction.apply(undefined, promiseFunctionArguments).then(- // on success pass results through- function onFulfilled (value) {- return value;- },-- // on rejection either retry, or throw the error- function onRejected (error) {- attemptsLeft -= 1;-- if (attemptsLeft < 1) {- throw error;- }-+module.exports.retryPromise = async function (attemptsLeft, promiseFunction, ...args) {+ while (true) {+ try {+ return await promiseFunction(...args);+ } catch (error) {+ if (--attemptsLeft < 1) throw error;events.emit('verbose', 'A retried call failed. Retrying ' + attemptsLeft + ' more time(s).');-- // retry call self again with the same arguments, except attemptsLeft is now lower- var fullArguments = [attemptsLeft, promiseFunction].concat(promiseFunctionArguments);- return module.exports.retryPromise.apply(undefined, fullArguments);}- );+ }};diff --git a/cordova/platforms/android/cordova/lib/run.js b/cordova/platforms/android/cordova/lib/run.jsindex 892e9b0ca..174165926 100644--- a/cordova/platforms/android/cordova/lib/run.js+++ b/cordova/platforms/android/cordova/lib/run.js@@ -19,21 +19,30 @@var path = require('path');var emulator = require('./emulator');-var device = require('./device');+const target = require('./target');var PackageType = require('./PackageType');-const { CordovaError, events } = require('cordova-common');+const { events } = require('cordova-common');-function getInstallTarget (runOptions) {- var install_target;+/**+ * Builds a target spec from a runOptions object+ *+ * @param {{target?: string, device?: boolean, emulator?: boolean}} runOptions+ * @return {target.TargetSpec}+ */+function buildTargetSpec (runOptions) {+ const spec = {};if (runOptions.target) {- install_target = runOptions.target;+ spec.id = runOptions.target;} else if (runOptions.device) {- install_target = '--device';+ spec.type = 'device';} else if (runOptions.emulator) {- install_target = '--emulator';+ spec.type = 'emulator';}+ return spec;+}- return install_target;+function formatResolvedTarget ({ id, type }) {+ return `${type} ${id}`;}/**@@ -50,57 +59,12 @@ module.exports.run = function (runOptions) {runOptions = runOptions || {};var self = this;- var install_target = getInstallTarget(runOptions);+ const spec = buildTargetSpec(runOptions);++ return target.resolve(spec).then(function (resolvedTarget) {+ events.emit('log', `Deploying to ${formatResolvedTarget(resolvedTarget)}`);- return Promise.resolve().then(function () {- if (!install_target) {- // no target given, deploy to device if available, otherwise use the emulator.- return device.list().then(function (device_list) {- if (device_list.length > 0) {- events.emit('warn', 'No target specified, deploying to device \'' + device_list[0] + '\'.');- install_target = device_list[0];- } else {- events.emit('warn', 'No target specified and no devices found, deploying to emulator');- install_target = '--emulator';- }- });- }- }).then(function () {- if (install_target === '--device') {- return device.resolveTarget(null);- } else if (install_target === '--emulator') {- // Give preference to any already started emulators. Else, start one.- return emulator.list_started().then(function (started) {- return started && started.length > 0 ? started[0] : emulator.start();- }).then(function (emulatorId) {- return emulator.resolveTarget(emulatorId);- });- }- // They specified a specific device/emulator ID.- return device.list().then(function (devices) {- if (devices.indexOf(install_target) > -1) {- return device.resolveTarget(install_target);- }- return emulator.list_started().then(function (started_emulators) {- if (started_emulators.indexOf(install_target) > -1) {- return emulator.resolveTarget(install_target);- }- return emulator.list_images().then(function (avds) {- // if target emulator isn't started, then start it.- for (var avd in avds) {- if (avds[avd].name === install_target) {- return emulator.start(install_target).then(function (emulatorId) {- return emulator.resolveTarget(emulatorId);- });- }- }- return Promise.reject(new CordovaError(`Target '${install_target}' not found, unable to run project`));- });- });- });- }).then(function (resolvedTarget) {return new Promise((resolve) => {- const builder = require('./builders/builders').getBuilder();const buildOptions = require('./build').parseBuildOptions(runOptions, null, self.root);// Android app bundles cannot be deployed directly to the device@@ -110,15 +74,13 @@ module.exports.run = function (runOptions) {throw packageTypeErrorMessage;}- resolve(builder.fetchBuildResults(buildOptions.buildType, buildOptions.arch));- }).then(function (buildResults) {- if (resolvedTarget && resolvedTarget.isEmulator) {- return emulator.wait_for_boot(resolvedTarget.target).then(function () {- return emulator.install(resolvedTarget, buildResults);- });+ resolve(self._builder.fetchBuildResults(buildOptions.buildType, buildOptions.arch));+ }).then(async function (buildResults) {+ if (resolvedTarget.type === 'emulator') {+ await emulator.wait_for_boot(resolvedTarget.id);}- return device.install(resolvedTarget, buildResults);+ return target.install(resolvedTarget, buildResults);});});};diff --git a/cordova/platforms/android/cordova/lib/target.js b/cordova/platforms/android/cordova/lib/target.jsnew file mode 100644index 000000000..ea0364010--- /dev/null+++ b/cordova/platforms/android/cordova/lib/target.js@@ -0,0 +1,155 @@+/*+ Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+*/++const path = require('path');+const { inspect } = require('util');+const Adb = require('./Adb');+const build = require('./build');+const emulator = require('./emulator');+const AndroidManifest = require('./AndroidManifest');+const { compareBy } = require('./utils');+const { retryPromise } = require('./retry');+const { events, CordovaError } = require('cordova-common');++const INSTALL_COMMAND_TIMEOUT = 5 * 60 * 1000;+const NUM_INSTALL_RETRIES = 3;+const EXEC_KILL_SIGNAL = 'SIGKILL';++/**+ * @typedef { 'device' | 'emulator' } TargetType+ * @typedef { { id: string, type: TargetType } } Target+ * @typedef { { id?: string, type?: TargetType } } TargetSpec+ */++/**+ * Returns a list of available targets (connected devices & started emulators)+ *+ * @return {Promise<Target[]>}+ */+exports.list = async () => {+ return (await Adb.devices())+ .map(id => ({+ id,+ type: id.startsWith('emulator-') ? 'emulator' : 'device'+ }));+};++/**+ * @param {TargetSpec?} spec+ * @return {Promise<Target>}+ */+async function resolveToOnlineTarget (spec = {}) {+ const targetList = await exports.list();+ if (targetList.length === 0) return null;++ // Sort by type: devices first, then emulators.+ targetList.sort(compareBy(t => t.type));++ // Find first matching target for spec. {} matches any target.+ return targetList.find(target =>+ Object.keys(spec).every(k => spec[k] === target[k])+ ) || null;+}++async function isEmulatorName (name) {+ const emus = await emulator.list_images();+ return emus.some(avd => avd.name === name);+}++/**+ * @param {TargetSpec?} spec+ * @return {Promise<Target>}+ */+async function resolveToOfflineEmulator (spec = {}) {+ if (spec.type === 'device') return null;+ if (spec.id && !(await isEmulatorName(spec.id))) return null;++ // try to start an emulator with name spec.id+ // if spec.id is undefined, picks best match regarding target API+ const emulatorId = await emulator.start(spec.id);++ return { id: emulatorId, type: 'emulator' };+}++/**+ * @param {TargetSpec?} spec+ * @return {Promise<Target & {arch: string}>}+ */+exports.resolve = async (spec = {}) => {+ events.emit('verbose', `Trying to find target matching ${inspect(spec)}`);++ const resolvedTarget =+ (await resolveToOnlineTarget(spec)) ||+ (await resolveToOfflineEmulator(spec));++ if (!resolvedTarget) {+ throw new CordovaError(`Could not find target matching ${inspect(spec)}`);+ }++ return {+ ...resolvedTarget,+ arch: await build.detectArchitecture(resolvedTarget.id)+ };+};++exports.install = async function ({ id: target, arch, type }, buildResults) {+ const apk_path = build.findBestApkForArchitecture(buildResults, arch);+ const manifest = new AndroidManifest(path.join(__dirname, '../../app/src/main/AndroidManifest.xml'));+ const pkgName = manifest.getPackageId();+ const launchName = pkgName + '/.' + manifest.getActivity().getName();++ events.emit('log', 'Using apk: ' + apk_path);+ events.emit('log', 'Package name: ' + pkgName);+ events.emit('verbose', `Installing app on target ${target}`);++ async function doInstall (execOptions = {}) {+ try {+ await Adb.install(target, apk_path, { replace: true, execOptions });+ } catch (error) {+ // CB-9557 CB-10157 only uninstall and reinstall app if the one that+ // is already installed on device was signed w/different certificate+ if (!/INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES/.test(error.toString())) throw error;++ events.emit('warn', 'Uninstalling app from device and reinstalling it again because the ' ++ 'installed app already signed with different key');++ // This promise is always resolved, even if 'adb uninstall' fails to uninstall app+ // or the app doesn't installed at all, so no error catching needed.+ await Adb.uninstall(target, pkgName);+ await Adb.install(target, apk_path, { replace: true });+ }+ }++ if (type === 'emulator') {+ // Work around sporadic emulator hangs: http://issues.apache.org/jira/browse/CB-9119+ await retryPromise(NUM_INSTALL_RETRIES, () => doInstall({+ timeout: INSTALL_COMMAND_TIMEOUT,+ killSignal: EXEC_KILL_SIGNAL+ }));+ } else {+ await doInstall();+ }+ events.emit('log', 'INSTALL SUCCESS');++ events.emit('verbose', 'Unlocking screen...');+ await Adb.shell(target, 'input keyevent 82');++ await Adb.start(target, launchName);+ events.emit('log', 'LAUNCH SUCCESS');+};diff --git a/cordova/platforms/android/cordova/lib/utils.js b/cordova/platforms/android/cordova/lib/utils.jsindex 760eda604..7436cac50 100644--- a/cordova/platforms/android/cordova/lib/utils.js+++ b/cordova/platforms/android/cordova/lib/utils.js@@ -24,7 +24,8 @@// TODO: Perhaps this should live in cordova-common?const fs = require('fs-extra');-const path = require('path');+const which = require('which');+const os = require('os');/*** Reads, searches, and replaces the found occurences with replacementString and then writes the file back out.@@ -41,57 +42,27 @@ exports.replaceFileContents = function (file, searchRegex, replacementString) {fs.writeFileSync(file, contents);};-/**- * Reads a file and scans for regex. Returns the line of the first occurence or null if no occurences are found.- *- * @param {string} file A file path- * @param {RegExp} regex A search regex- * @returns string|null- */-exports.grep = function (file, regex) {- const contents = fs.readFileSync(file).toString().replace(/\\r/g, '').split('\n');- for (let i = 0; i < contents.length; i++) {- const line = contents[i];- if (regex.test(line)) {- return line;+// Some helpers for easier sorting+exports.compare = (a, b) => (a < b && -1) || +(a > b);+exports.compareBy = f => (a, b) => exports.compare(f(a), f(b));+exports.compareByAll = fns => {+ const comparators = fns.map(exports.compareBy);+ return (a, b) => {+ for (const cmp of comparators) {+ const result = cmp(a, b);+ if (result) return result;}- }- return null;+ return 0;+ };};-/**- * Scans directories and outputs a list of found paths that matches the regex- *- * @param {string} directory The starting directory- * @param {RegExp} regex The search regex- * @param {boolean} recursive Enables recursion- * @returns Array<string>- */-exports.scanDirectory = function (directory, regex, recursive) {- let output = [];-- if (fs.existsSync(directory)) {- const items = fs.readdirSync(directory);-- for (let i = 0; i < items.length; i++) {- const item = items[i];- const itemPath = path.join(directory, item);- const stats = fs.statSync(itemPath);-- if (regex.test(itemPath)) {- output.push(itemPath);- }+exports.forgivingWhichSync = (cmd) => {+ const whichResult = which.sync(cmd, { nothrow: true });- if (stats.isDirectory()) {- if (recursive) {- output = output.concat(exports.scanDirectory(itemPath, regex, recursive));- } else {- // Move onto the next item- continue;- }- }- }- }-- return output;+ // On null, returns empty string to maintain backwards compatibility+ // realpathSync follows symlinks+ return whichResult === null ? '' : fs.realpathSync(whichResult);};++exports.isWindows = () => os.platform() === 'win32';+exports.isDarwin = () => os.platform() === 'darwin';diff --git a/cordova/platforms/android/gradle/wrapper/gradle-wrapper.jar b/cordova/platforms/android/gradle/wrapper/gradle-wrapper.jarindex e708b1c02..7454180f2 100644Binary files a/cordova/platforms/android/gradle/wrapper/gradle-wrapper.jar and b/cordova/platforms/android/gradle/wrapper/gradle-wrapper.jar differdiff --git a/cordova/platforms/android/gradlew b/cordova/platforms/android/gradlewindex 4f906e0c8..744e882ed 100755--- a/cordova/platforms/android/gradlew+++ b/cordova/platforms/android/gradlew@@ -72,7 +72,7 @@ case "`uname`" inDarwin* )darwin=true;;- MINGW* )+ MSYS* | MINGW* )msys=true;;NONSTOP* )diff --git a/cordova/platforms/android/platform_www/cordova.js b/cordova/platforms/android/platform_www/cordova.jsindex 3d71792dd..4154b29c2 100644--- a/cordova/platforms/android/platform_www/cordova.js+++ b/cordova/platforms/android/platform_www/cordova.js@@ -1,5 +1,5 @@// Platform: android-// 538a985db128858c0a0eb4dd40fb9c8e5433fc94+// cordova-js rel/6.0.0-10-g07379820/*Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreements. See the NOTICE file@@ -19,7 +19,7 @@under the License.*/;(function() {-var PLATFORM_VERSION_BUILD_LABEL = '9.0.0';+var PLATFORM_VERSION_BUILD_LABEL = '9.1.0';// file: src/scripts/require.jsvar require;var define;diff --git a/cordova/platforms/android/platform_www/cordova_plugins.js b/cordova/platforms/android/platform_www/cordova_plugins.jsindex f090a9271..6ed6072bc 100644--- a/cordova/platforms/android/platform_www/cordova_plugins.js+++ b/cordova/platforms/android/platform_www/cordova_plugins.js@@ -73,14 +73,6 @@ cordova.define('cordova/plugin_list', function(require, exports, module) {"CameraPopoverHandle"]},- {- "id": "cordova-plugin-chooser.Chooser",- "file": "plugins/cordova-plugin-chooser/www/chooser.js",- "pluginId": "cordova-plugin-chooser",- "clobbers": [- "chooser"- ]- },{"id": "cordova-plugin-file.DirectoryEntry","file": "plugins/cordova-plugin-file/www/DirectoryEntry.js",@@ -279,18 +271,16 @@ cordova.define('cordova/plugin_list', function(require, exports, module) {];module.exports.metadata = {"com-darryncampbell-cordova-plugin-intent": "2.0.0",- "com.ourcodeworld.plugins.Filebrowser": "1.0.0","com.whebcraft.cordova.plugin.downloader": "0.1.0","cordova-plugin-add-swift-support": "2.0.2","cordova-plugin-androidx-adapter": "1.1.3","cordova-plugin-device": "2.0.3","cordova-plugin-background-mode": "0.7.3",- "cordova-plugin-camera": "4.1.0",- "cordova-plugin-chooser": "1.3.1",- "cordova-plugin-file": "7.0.0-dev",- "cordova-plugin-file-opener2": "3.0.4",+ "cordova-plugin-camera": "5.0.1",+ "cordova-plugin-file": "6.0.2",+ "cordova-plugin-file-opener2": "3.0.5","cordova-plugin-whitelist": "1.3.4","es6-promise-plugin": "4.2.2",- "cordova-plugin-x-socialsharing": "5.6.8"+ "cordova-plugin-x-socialsharing": "6.0.3"};-});\ No newline at end of file+});diff --git a/cordova/platforms/android/platform_www/plugins/cordova-plugin-camera/www/CameraConstants.js b/cordova/platforms/android/platform_www/plugins/cordova-plugin-camera/www/CameraConstants.jsindex 4f4b046f1..0fe4c6d03 100644--- a/cordova/platforms/android/platform_www/plugins/cordova-plugin-camera/www/CameraConstants.js+++ b/cordova/platforms/android/platform_www/plugins/cordova-plugin-camera/www/CameraConstants.js@@ -27,20 +27,14 @@ module.exports = {/*** @description* Defines the output format of `Camera.getPicture` call.- * _Note:_ On iOS passing `DestinationType.NATIVE_URI` along with- * `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM` will- * disable any image modifications (resize, quality change, cropping, etc.) due- * to implementation specific.** @enum {number}*/DestinationType: {- /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI or NATIVE_URI if possible */+ /** Return base64 encoded string. DATA_URL can be very memory intensive and cause app crashes or out of memory errors. Use FILE_URI if possible */DATA_URL: 0,/** Return file uri (content://media/external/images/media/2 for Android) */- FILE_URI: 1,- /** Return native uri (eg. asset-library://... for iOS) */- NATIVE_URI: 2+ FILE_URI: 1},/*** @enum {number}@@ -65,9 +59,6 @@ module.exports = {/*** @description* Defines the output format of `Camera.getPicture` call.- * _Note:_ On iOS passing `PictureSourceType.PHOTOLIBRARY` or `PictureSourceType.SAVEDPHOTOALBUM`- * along with `DestinationType.NATIVE_URI` will disable any image modifications (resize, quality- * change, cropping, etc.) due to implementation specific.** @enum {number}*/diff --git a/cordova/platforms/android/platform_www/plugins/cordova-plugin-chooser/www/chooser.js b/cordova/platforms/android/platform_www/plugins/cordova-plugin-chooser/www/chooser.jsdeleted file mode 100644index 74a433887..000000000--- a/cordova/platforms/android/platform_www/plugins/cordova-plugin-chooser/www/chooser.js+++ /dev/null@@ -1,120 +0,0 @@-cordova.define("cordova-plugin-chooser.Chooser", function(require, exports, module) {-/** @see sodiumutil */-function from_base64 (sBase64, nBlocksSize) {- function _b64ToUint6 (nChr) {- return nChr > 64 && nChr < 91 ?- nChr - 65 :- nChr > 96 && nChr < 123 ?- nChr - 71 :- nChr > 47 && nChr < 58 ?- nChr + 4 :- nChr === 43 ?- 62 :- nChr === 47 ?- 63 :- 0;- }-- var nInLen = sBase64.length;- var nOutLen = nBlocksSize ?- Math.ceil(((nInLen * 3 + 1) >> 2) / nBlocksSize) * nBlocksSize :- (nInLen * 3 + 1) >> 2;- var taBytes = new Uint8Array(nOutLen);-- for (- var nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0;- nInIdx < nInLen;- nInIdx++- ) {- nMod4 = nInIdx & 3;- nUint24 |= _b64ToUint6(sBase64.charCodeAt(nInIdx)) << (18 - 6 * nMod4);- if (nMod4 === 3 || nInLen - nInIdx === 1) {- for (- nMod3 = 0;- nMod3 < 3 && nOutIdx < nOutLen;- nMod3++, nOutIdx++- ) {- taBytes[nOutIdx] = (nUint24 >>> ((16 >>> nMod3) & 24)) & 255;- }- nUint24 = 0;- }- }-- return taBytes;-}--function getFileInternal (- accept,- includeData,- successCallback,- failureCallback-) {- if (typeof accept === 'function') {- failureCallback = successCallback;- successCallback = accept;- accept = undefined;- }-- var result = new Promise(function (resolve, reject) {- cordova.exec(- function (json) {- if (json === 'RESULT_CANCELED') {- resolve();- return;- }-- try {- var o = JSON.parse(json);-- if (includeData) {- var base64Data = o.data.replace(- /[^A-Za-z0-9\+\/]/g,- ''- );-- o.data = from_base64(base64Data);- o.dataURI =- 'data:' + o.mediaType + ';base64,' + base64Data;- }- else {- delete o.data;- }-- resolve(o);- }- catch (err) {- reject(err);- }- },- reject,- 'Chooser',- 'getFile',- [- (typeof accept === 'string' ?- accept.toLowerCase().replace(/\s/g, '') :- undefined) || '*/*',- includeData- ]- );- });-- if (typeof successCallback === 'function') {- result.then(successCallback);- }- if (typeof failureCallback === 'function') {- result.catch(failureCallback);- }-- return result;-}--module.exports = {- getFile: function (accept, successCallback, failureCallback) {- return getFileInternal(accept, true, successCallback, failureCallback);- },- getFileMetadata: function (accept, successCallback, failureCallback) {- return getFileInternal(accept, false, successCallback, failureCallback);- }-};--});diff --git a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/DirectoryEntry.js b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/DirectoryEntry.jsindex fcd620c74..bb676eb6c 100644--- a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/DirectoryEntry.js+++ b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/DirectoryEntry.js@@ -37,6 +37,7 @@ var DirectoryReader = require('./DirectoryReader');* {FileSystem} filesystem on which the directory resides (readonly)*/var DirectoryEntry = function (name, fullPath, fileSystem, nativeURL) {+// add trailing slash if it is missingif ((fullPath) && !/\/$/.test(fullPath)) {fullPath += '/';diff --git a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/Entry.js b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/Entry.jsindex 5db846cfa..b296d999e 100644--- a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/Entry.js+++ b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/Entry.js@@ -152,7 +152,7 @@ Entry.prototype.copyTo = function (parent, newName, successCallback, errorCallbaerrorCallback(new FileError(code));};var srcURL = this.toInternalURL();- // entry name+ // entry namevar name = newName || this.name;// success callbackvar success = function (entry) {diff --git a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileReader.js b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileReader.jsindex 36d4dd4e6..5c030913b 100644--- a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileReader.js+++ b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileReader.js@@ -76,24 +76,12 @@ function defineEvent (eventName) {this._realReader[eventName] = value;});}--// When the read starts.-defineEvent('onloadstart');--// While reading (and decoding) file or fileBlob data, and reporting partial file data (progress.loaded/progress.total)-defineEvent('onprogress');--// When the read has successfully completed.-defineEvent('onload');--// When the read has failed (see errors).-defineEvent('onerror');--// When the request has completed (either in success or failure).-defineEvent('onloadend');--// When the read has been aborted. For instance, by invoking the abort() method.-defineEvent('onabort');+defineEvent('onloadstart'); // When the read starts.+defineEvent('onprogress'); // While reading (and decoding) file or fileBlob data, and reporting partial file data (progress.loaded/progress.total)+defineEvent('onload'); // When the read has successfully completed.+defineEvent('onerror'); // When the read has failed (see errors).+defineEvent('onloadend'); // When the request has completed (either in success or failure).+defineEvent('onabort'); // When the read has been aborted. For instance, by invoking the abort() method.function initRead (reader, file) {// Already loading something@@ -114,7 +102,7 @@ function initRead (reader, file) {}if (reader.onloadstart) {- reader.onloadstart(new ProgressEvent('loadstart', { target: reader }));+ reader.onloadstart(new ProgressEvent('loadstart', {target: reader}));}}@@ -138,12 +126,10 @@ function readSuccessCallback (readType, encoding, offset, totalSize, accumulate,if (readType === 'readAsDataURL') {// Windows proxy does not support reading file slices as Data URLs// so read the whole file at once.- CHUNK_SIZE = cordova.platformId === 'windows' ? totalSize // eslint-disable-line no-undef- : (- // Calculate new chunk size for data URLs to be multiply of 3- // Otherwise concatenated base64 chunks won't be valid base64 data- FileReader.READ_CHUNK_SIZE - (FileReader.READ_CHUNK_SIZE % 3) + 3- );+ CHUNK_SIZE = cordova.platformId === 'windows' ? totalSize : // eslint-disable-line no-undef+ // Calculate new chunk size for data URLs to be multiply of 3+ // Otherwise concatenated base64 chunks won't be valid base64 data+ FileReader.READ_CHUNK_SIZE - (FileReader.READ_CHUNK_SIZE % 3) + 3;}if (typeof r !== 'undefined') {@@ -151,7 +137,7 @@ function readSuccessCallback (readType, encoding, offset, totalSize, accumulate,this._progress = Math.min(this._progress + CHUNK_SIZE, totalSize);if (typeof this.onprogress === 'function') {- this.onprogress(new ProgressEvent('progress', { loaded: this._progress, total: totalSize }));+ this.onprogress(new ProgressEvent('progress', {loaded: this._progress, total: totalSize}));}}@@ -171,11 +157,11 @@ function readSuccessCallback (readType, encoding, offset, totalSize, accumulate,this._readyState = FileReader.DONE;if (typeof this.onload === 'function') {- this.onload(new ProgressEvent('load', { target: this }));+ this.onload(new ProgressEvent('load', {target: this}));}if (typeof this.onloadend === 'function') {- this.onloadend(new ProgressEvent('loadend', { target: this }));+ this.onloadend(new ProgressEvent('loadend', {target: this}));}}}@@ -194,11 +180,11 @@ function readFailureCallback (e) {this._error = new FileError(e);if (typeof this.onerror === 'function') {- this.onerror(new ProgressEvent('error', { target: this }));+ this.onerror(new ProgressEvent('error', {target: this}));}if (typeof this.onloadend === 'function') {- this.onloadend(new ProgressEvent('loadend', { target: this }));+ this.onloadend(new ProgressEvent('loadend', {target: this}));}}@@ -219,11 +205,11 @@ FileReader.prototype.abort = function () {// If abort callbackif (typeof this.onabort === 'function') {- this.onabort(new ProgressEvent('abort', { target: this }));+ this.onabort(new ProgressEvent('abort', {target: this}));}// If load end callbackif (typeof this.onloadend === 'function') {- this.onloadend(new ProgressEvent('loadend', { target: this }));+ this.onloadend(new ProgressEvent('loadend', {target: this}));}};diff --git a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileWriter.js b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileWriter.jsindex 9f141e085..c3e856219 100644--- a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileWriter.js+++ b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/FileWriter.js@@ -54,23 +54,12 @@ var FileWriter = function (file) {this.error = null;// Event handlers- // When writing starts- this.onwritestart = null;-- // While writing the file, and reporting partial file data- this.onprogress = null;-- // When the write has successfully completed.- this.onwrite = null;-- // When the request has completed (either in success or failure).- this.onwriteend = null;-- // When the write has been aborted. For instance, by invoking the abort() method.- this.onabort = null;-- // When the write has failed (see errors).- this.onerror = null;+ this.onwritestart = null; // When writing starts+ this.onprogress = null; // While writing the file, and reporting partial file data+ this.onwrite = null; // When the write has successfully completed.+ this.onwriteend = null; // When the request has completed (either in success or failure).+ this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method.+ this.onerror = null; // When the write has failed (see errors).};// States@@ -94,12 +83,12 @@ FileWriter.prototype.abort = function () {// If abort callbackif (typeof this.onabort === 'function') {- this.onabort(new ProgressEvent('abort', { target: this }));+ this.onabort(new ProgressEvent('abort', {'target': this}));}// If write end callbackif (typeof this.onwriteend === 'function') {- this.onwriteend(new ProgressEvent('writeend', { target: this }));+ this.onwriteend(new ProgressEvent('writeend', {'target': this}));}};@@ -110,6 +99,7 @@ FileWriter.prototype.abort = function () {* @param isPendingBlobReadResult {Boolean} true if the data is the pending blob read operation result*/FileWriter.prototype.write = function (data, isPendingBlobReadResult) {+var that = this;var supportsBinary = (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined');/* eslint-disable no-undef */@@ -133,12 +123,12 @@ FileWriter.prototype.write = function (data, isPendingBlobReadResult) {// If onerror callbackif (typeof that.onerror === 'function') {- that.onerror(new ProgressEvent('error', { target: that }));+ that.onerror(new ProgressEvent('error', {'target': that}));}// If onwriteend callbackif (typeof that.onwriteend === 'function') {- that.onwriteend(new ProgressEvent('writeend', { target: that }));+ that.onwriteend(new ProgressEvent('writeend', {'target': that}));}};@@ -172,7 +162,7 @@ FileWriter.prototype.write = function (data, isPendingBlobReadResult) {// If onwritestart callbackif (typeof me.onwritestart === 'function') {- me.onwritestart(new ProgressEvent('writestart', { target: me }));+ me.onwritestart(new ProgressEvent('writestart', {'target': me}));}// Write file@@ -195,12 +185,12 @@ FileWriter.prototype.write = function (data, isPendingBlobReadResult) {// If onwrite callbackif (typeof me.onwrite === 'function') {- me.onwrite(new ProgressEvent('write', { target: me }));+ me.onwrite(new ProgressEvent('write', {'target': me}));}// If onwriteend callbackif (typeof me.onwriteend === 'function') {- me.onwriteend(new ProgressEvent('writeend', { target: me }));+ me.onwriteend(new ProgressEvent('writeend', {'target': me}));}},// Error callback@@ -218,12 +208,12 @@ FileWriter.prototype.write = function (data, isPendingBlobReadResult) {// If onerror callbackif (typeof me.onerror === 'function') {- me.onerror(new ProgressEvent('error', { target: me }));+ me.onerror(new ProgressEvent('error', {'target': me}));}// If onwriteend callbackif (typeof me.onwriteend === 'function') {- me.onwriteend(new ProgressEvent('writeend', { target: me }));+ me.onwriteend(new ProgressEvent('writeend', {'target': me}));}}, 'File', 'write', [this.localURL, data, this.position, isBinary]);};@@ -279,7 +269,7 @@ FileWriter.prototype.truncate = function (size) {// If onwritestart callbackif (typeof me.onwritestart === 'function') {- me.onwritestart(new ProgressEvent('writestart', { target: this }));+ me.onwritestart(new ProgressEvent('writestart', {'target': this}));}// Write file@@ -300,12 +290,12 @@ FileWriter.prototype.truncate = function (size) {// If onwrite callbackif (typeof me.onwrite === 'function') {- me.onwrite(new ProgressEvent('write', { target: me }));+ me.onwrite(new ProgressEvent('write', {'target': me}));}// If onwriteend callbackif (typeof me.onwriteend === 'function') {- me.onwriteend(new ProgressEvent('writeend', { target: me }));+ me.onwriteend(new ProgressEvent('writeend', {'target': me}));}},// Error callback@@ -323,12 +313,12 @@ FileWriter.prototype.truncate = function (size) {// If onerror callbackif (typeof me.onerror === 'function') {- me.onerror(new ProgressEvent('error', { target: me }));+ me.onerror(new ProgressEvent('error', {'target': me}));}// If onwriteend callbackif (typeof me.onwriteend === 'function') {- me.onwriteend(new ProgressEvent('writeend', { target: me }));+ me.onwriteend(new ProgressEvent('writeend', {'target': me}));}}, 'File', 'truncate', [this.localURL, size]);};diff --git a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.jsindex 494de62ff..73715bc0e 100644--- a/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js+++ b/cordova/platforms/android/platform_www/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js@@ -70,7 +70,7 @@ cordova.define("cordova-plugin-file.resolveLocalFileSystemURI", function(requirefileSystems.getFs(fsName, function (fs) {// This should happen only on platforms that haven't implemented requestAllFileSystems (windows)if (!fs) {- fs = new FileSystem(fsName, { name: '', fullPath: '/' }); // eslint-disable-line no-undef+ fs = new FileSystem(fsName, {name: '', fullPath: '/'}); // eslint-disable-line no-undef}var result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath, fs, entry.nativeURL) : new FileEntry(entry.name, entry.fullPath, fs, entry.nativeURL);successCallback(result);diff --git a/cordova/platforms/android/project.properties b/cordova/platforms/android/project.propertiesindex b50c4413f..6c069afe2 100644--- a/cordova/platforms/android/project.properties+++ b/cordova/platforms/android/project.properties@@ -15,4 +15,4 @@ cordova.system.library.1=androidx.core:core:1.1.0cordova.gradle.include.1=com.ourcodeworld.plugins.Filebrowser/mobileapp-plugin.gradlecordova.system.library.2=androidx.legacy:legacy-support-v4:1.0.0cordova.system.library.3=androidx.legacy:legacy-support-v4:1.0.0-cordova.system.library.4=androidx.legacy:legacy-support-v4:1.0.0\ No newline at end of file+cordova.system.library.4=androidx.legacy:legacy-support-v4:1.0.0diff --git a/cordova/platforms/android/repositories.gradle b/cordova/platforms/android/repositories.gradlenew file mode 100644index 000000000..1384d1457--- /dev/null+++ b/cordova/platforms/android/repositories.gradle@@ -0,0 +1,22 @@+/* Licensed to the Apache Software Foundation (ASF) under one+ or more contributor license agreements. See the NOTICE file+ distributed with this work for additional information+ regarding copyright ownership. The ASF licenses this file+ to you under the Apache License, Version 2.0 (the+ "License"); you may not use this file except in compliance+ with the License. You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing,+ software distributed under the License is distributed on an+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY+ KIND, either express or implied. See the License for the+ specific language governing permissions and limitations+ under the License.+*/++ext.repos = {+ google()+ jcenter()+}diff --git a/package.json b/package.jsonindex 03d407ffb..3bc98e6a9 100644--- a/package.json+++ b/package.json@@ -72,7 +72,7 @@"run-android-dev": "yarn prepare-cordova && yarn build-cordova-dev && cd cordova && cordova run android && cd ..","run-ios-dev": "yarn prepare-cordova && yarn build-cordova-dev && cd cordova && cordova run ios && cd ..","cordova-list-emulators": "cd cordova && cordova run --list --emulator && cd ..",- "cordova-add-android": "cd cordova && cordova platform add android && cd ..",+ "cordova-add-android": "cd cordova && cordova platform add [email protected] && cd ..","cordova-remove-android": "cd cordova && cordova platform remove android && cd ..","cordova-add-ios": "cd cordova && cordova platform add ios && cd ..","cordova-remove-ios": "cd cordova && cordova platform remove ios && cd ..",