jfoclpf commented on issue #426:
URL: 
https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-1386031952

   This is becoming a bit messy :) 
   
   From updating from SDK v30 upwards the APP breaks  exactly by merely 
_reading_ the file system (cordova `v11` and cordova-android `v10.1.2`)
   
       jquery.min.js:2 Not allowed to load local resource: 
file:///android_asset/www/json/anomalies.json
   
   ```js
   $.getJSON(cordova.file.applicationDirectory + 'www/json/anomalies.json', 
function (data) {
      console.log(data)
   })
   ```
   
   1 - @breautek just confirm me please, if I remember correctly the issue 
regarding the transition from SDK 29 upwards was merely related with _writing_ 
content to the device file system, right?
   
   2 - @alex-steinberg mentions replacing `file://` by `http://localhost`. Does 
this work? If yes, shouldn't `cordova.file.applicationDirectory` be updated 
accordingly?
   
   My package.json:
   
   <details>
   
   ```json
   {
     "name": "in-my-district",
     "displayName": "In my District!",
     "version": "1.2.25",
     "description": "Report to your municipality certain irregularities in your 
neighborhood or district",
     "homepage": "https://nomeubairro.app/";,
     "android-version-code": 10225,
     "scripts": {
       "test": "standard && node test/convertHbsToHtml.js && html-validate 
test/www/index.html && printf '\\n\\nTest OK\\n\\n'",
       "version": "cordova-set-version --version ${npm_package_version} && git 
add config.xml && node scripts/setAndroidVersionCode.js -v 
${npm_package_version} && git add package.json",
       "push-version": "git push && git push origin v${npm_package_version}",
       "build-release-apk": "npm test && scripts/buildReleaseAPK.sh",
       "build-release-aab": "npm test && scripts/buildReleaseAAB.sh",
       "run-release-on-device": "scripts/runReleaseOnDevice.sh",
       "run-debug-on-device": "adb get-state 1>/dev/null 2>&1 && echo 'DEVICE 
ATTACHED' || { echo 'No device attached'; exit 1; } && cordova run android 
--device --debug",
       "regenerate-png-files": "./res/icon/generateIcons.sh && 
./res/screen/generateScreens.sh && cp res/icon/android/512.png www/img/logo.png 
&& cp res/icon/android/512.png 
../fastlane/metadata/android/en-US/images/icon.png && git add res/* 
www/img/logo.png ../fastlane/metadata/android/en-US/images/icon.png && git 
commit -m 'PNGs regenerated'"
     },
     "repository": {
       "type": "git",
       "url": "git://github.com/jfoclpf/in-my-district.git"
     },
     "author": "João Pimentel Ferreira",
     "license": "GPL-3.0",
     "dependencies": {
       "@fortawesome/fontawesome-free": "6.2.1",
       "async": "^3.2.4",
       "bootstrap": "^5.2.3",
       "cordova": "^11.1.0",
       "cordova-browser": "^6.0.0",
       "cordova-import-npm": "^1.0.35",
       "cordova-pdf-generator": "^2.1.1",
       "cordova-plugin-cache-clear": "^1.3.8",
       "cordova-plugin-device": "^2.1.0",
       "cordova-plugin-geolocation": "^4.1.0",
       "cordova-plugin-inappbrowser": "^5.0.0",
       "cordova-plugin-is-debug": "^1.0.0",
       "cordova-plugin-screen-orientation": "^3.0.2",
       "cordova-plugin-simple-image-resizer": "0.2.0",
       "cordova-plugin-splashscreen": "^6.0.2",
       "cordova-plugin-statusbar": "^3.0.0",
       "cordova-plugin-whitelist": "^1.3.4",
       "cordova-set-version": "^13.0.1",
       "crypto-js": "^4.1.1",
       "es6-promise-plugin": "^4.2.2",
       "exif-js": "^2.3.0",
       "express-handlebars": "^6.0.6",
       "fs": "0.0.1-security",
       "jAlert": "^4.9.1",
       "jquery": "^3.6.3",
       "leaflet": "^1.9.3",
       "leaflet-image": "^0.4.0",
       "leaflet.markercluster": "^1.5.3",
       "path": "^0.12.7",
       "whitelist": "^1.0.2"
     },
     "cordova": {
       "plugins": {
         "cordova-plugin-geolocation": {
           "GPS_REQUIRED": "true"
         },
         "cordova-plugin-email-composer": {
           "ANDROID_SUPPORT_V4_VERSION": "27.+"
         },
         "cordova-plugin-statusbar": {},
         "cordova-plugin-screen-orientation": {},
         "cordova-plugin-device": {},
         "cordova-plugin-whitelist": {},
         "cordova-pdf-generator": {},
         "cordova-plugin-splashscreen": {},
         "cordova-plugin-inappbrowser": {},
         "cordova-plugin-is-debug": {},
         "cordova-plugin-androidx-adapter": {},
         "cordova-plugin-file": {
           "ANDROIDX_WEBKIT_VERSION": "1.4.0"
         },
         "cordova-plugin-camera": {
           "ANDROID_SUPPORT_V4_VERSION": "27.+",
           "ANDROIDX_CORE_VERSION": "1.6.+"
         },
         "cordova-plugin-network-information": {},
         "cordova-plugin-app-version": {},
         "@globules-io/cordova-plugin-ios-xhr": {},
         "cordova-plugin-simple-image-resizer": {
           "ANDROID_EXIFINTERFACES_VERSION": "27.+"
         }
       },
       "platforms": [
         "ios",
         "android"
       ]
     },
     "devDependencies": {
       "@globules-io/cordova-plugin-ios-xhr": 
"github:globules-io/cordova-plugin-ios-xhr",
       "command-line-args": "^5.2.1",
       "cordova-android": "^10.1.2",
       "cordova-plugin-androidx-adapter": "^1.1.3",
       "cordova-plugin-app-version": "^0.1.14",
       "cordova-plugin-camera": "^6.0.0",
       "cordova-plugin-email-composer": 
"github:jfoclpf/cordova-plugin-email-composer#pr-Fix_361-Android_11_support",
       "cordova-plugin-file": "^7.0.0",
       "cordova-plugin-network-information": "^3.0.0",
       "fs-extra": "^11.1.0",
       "handlebars": "^4.7.7",
       "html-minifier": "^4.0.0",
       "html-validate": "^7.13.1",
       "npm-check-updates": "^16.6.2",
       "semver": "^7.3.8",
       "standard": "^17.0.0",
       "uglify-js": "^3.17.4",
       "uglifycss": "0.0.29",
       "walk": "^2.3.15",
       "xml2js": "^0.4.23"
     },
     "standard": {
       "ignore": [
         "www/js/res/*",
         "test/www/*",
         "platforms/",
         "plugins/"
       ]
     }
   }
   ```
   </details>
   
   config.xml:
   <details>
   
   ```xml
   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <widget id="com.in.my.district" version="1.2.25" 
xmlns="http://www.w3.org/ns/widgets"; 
xmlns:cdv="http://cordova.apache.org/ns/1.0";>
     <name>No meu Bairro!</name>
     <description>
       Comunique ao seu município anomalias no seu bairro, como buracos na 
calçada ou lixo por recolher
     </description>
     <author email="[email protected]" 
href="https://www.joaopimentel.com/";>
       João Pimentel Ferreira
     </author>
     <content src="index.html"/>
     <icon height="512" src="res/icon/universal/512.png" width="512"/>
     <icon density="xhdpi" height="196" src="res/icon/universal/196.png" 
width="196"/>
     <icon density="xxxhdpi" height="192" src="res/icon/universal/192.png" 
width="192"/>
     <icon density="xxhdpi" height="144" src="res/icon/universal/144.png" 
width="144"/>
     <icon density="hdpi" height="72" src="res/icon/universal/72.png" 
width="72"/>
     <icon density="mdpi" height="48" src="res/icon/universal/48.png" 
width="48"/>
     <access origin="*"/>
     <allow-navigation href="*"/>
     <allow-intent href="http://*/*"/>
     <allow-intent href="https://*/*"/>
     <preference name="OverrideUserAgent" value="APP/com.in.my.district"/>
     <preference name="windows-target-version" value="10.0"/>
     <preference name="windows-phone-target-version" value="10.0"/>
     <preference name="iosExtraFilesystems" 
value="library,library-nosync,documents,documents-nosync,cache,bundle"/>
     <preference name="AndroidExtraFilesystems" 
value="files,files-external,documents,sdcard,cache,cache-external,assets"/>
     <preference name="StatusBarOverlaysWebView" value="false"/>
     <preference name="StatusBarBackgroundColor" value="#FFFFFF"/>
     <preference name="StatusBarStyle" value="blacktranslucent"/>
     <preference name="AndroidXEnabled" value="true"/>
     <hook src="hooks/generateJsFiles.js" type="before_prepare"/>
     <hook src="hooks/convertHbsToHtml.js" type="after_prepare"/>
     <hook src="hooks/minifyFiles.js" type="after_prepare"/>
     <hook src="node_modules/cordova-import-npm/scripts/importNpmPackages.js" 
type="before_prepare"/>
     <platform name="android">
       <preference name="android-minSdkVersion" value="31"/>
       <preference name="android-targetSdkVersion" value="33"/>
       <preference name="AndroidPersistentFileLocation" value="Compatibility"/>
       <allow-intent href="market:*"/>
       <icon height="512" src="res/icon/android/512.png" width="512"/>
       <icon density="xhdpi" height="192" src="res/icon/android/192.png" 
width="192"/>
       <icon density="xxxhdpi" height="192" src="res/icon/android/192.png" 
width="192"/>
       <icon density="xxhdpi" height="144" src="res/icon/android/144.png" 
width="144"/>
       <icon density="hdpi" height="72" src="res/icon/android/72.png" 
width="72"/>
       <icon density="mdpi" height="48" src="res/icon/android/48.png" 
width="48"/>
       <splash density="hdpi" 
src="res/screen/android/screen-hdpi-portrait.png"/>
       <splash density="port-hdpi" 
src="res/screen/android/screen-hdpi-portrait.png"/>
       <splash density="ldpi" 
src="res/screen/android/screen-ldpi-portrait.png"/>
       <splash density="port-ldpi" 
src="res/screen/android/screen-ldpi-portrait.png"/>
       <splash density="mdpi" 
src="res/screen/android/screen-mdpi-portrait.png"/>
       <splash density="port-mdpi" 
src="res/screen/android/screen-mdpi-portrait.png"/>
       <splash density="xhdpi" 
src="res/screen/android/screen-xhdpi-portrait.png"/>
       <splash density="port-xhdpi" 
src="res/screen/android/screen-xhdpi-portrait.png"/>
     </platform>
     <platform name="ios">
       <allow-intent href="itms:*"/>
       <allow-intent href="itms-apps:*"/>
       <icon src="res/icon/ios/16.png" width="16" height="16"/>
       <icon src="res/icon/ios/20.png" width="20" height="20"/>
       <icon src="res/icon/ios/29.png" width="29" height="29"/>
       <icon src="res/icon/ios/32.png" width="32" height="32"/>
       <icon src="res/icon/ios/40.png" width="40" height="40"/>
       <icon src="res/icon/ios/48.png" width="48" height="48"/>
       <icon src="res/icon/ios/50.png" width="50" height="50"/>
       <icon src="res/icon/ios/55.png" width="55" height="55"/>
       <icon src="res/icon/ios/57.png" width="57" height="57"/>
       <icon src="res/icon/ios/58.png" width="58" height="58"/>
       <icon src="res/icon/ios/60.png" width="60" height="60"/>
       <icon src="res/icon/ios/64.png" width="64" height="64"/>
       <icon src="res/icon/ios/72.png" width="72" height="72"/>
       <icon src="res/icon/ios/76.png" width="76" height="76"/>
       <icon src="res/icon/ios/80.png" width="80" height="80"/>
       <icon src="res/icon/ios/87.png" width="87" height="87"/>
       <icon src="res/icon/ios/88.png" width="88" height="88"/>
       <icon src="res/icon/ios/100.png" width="100" height="100"/>
       <icon src="res/icon/ios/114.png" width="114" height="114"/>
       <icon src="res/icon/ios/120.png" width="120" height="120"/>
       <icon src="res/icon/ios/128.png" width="128" height="128"/>
       <icon src="res/icon/ios/144.png" width="144" height="144"/>
       <icon src="res/icon/ios/152.png" width="152" height="152"/>
       <icon src="res/icon/ios/167.png" width="167" height="167"/>
       <icon src="res/icon/ios/172.png" width="172" height="172"/>
       <icon src="res/icon/ios/180.png" width="180" height="180"/>
       <icon src="res/icon/ios/196.png" width="196" height="196"/>
       <icon src="res/icon/ios/216.png" width="216" height="216"/>
       <icon src="res/icon/ios/256.png" width="256" height="256"/>
       <icon src="res/icon/ios/512.png" width="512" height="512"/>
       <icon src="res/icon/ios/1024.png" width="1024" height="1024"/>
       <preference name="iosPersistentFileLocation" value="Library"/>
       <preference name="NativeXHRLogging" value="full"/>
       <preference name="AllowUntrustedCerts" value="true"/>
       <preference name="InterceptRemoteRequests" value="all"/>
       <preference name="CustomUserAgent" value="APP/com.in.my.district"/>
       <preference name="allowFileAccessFromFileURLs" value="true"/>
       <preference name="allowUniversalAccessFromFileURLs" value="true"/>
       <edit-config target="NSLocationWhenInUseUsageDescription" 
file="*-Info.plist" mode="merge">
         <string>Necessita da sua localização para indicar o endereço da 
ocorrência a ser enviada ao seu município</string>
       </edit-config>
       <edit-config target="NSLocationAlwaysAndWhenInUseUsageDescription" 
file="*-Info.plist" mode="merge">
         <string>Necessita da sua localização para indicar o endereço da 
ocorrência a ser enviada ao seu município</string>
       </edit-config>
       <edit-config target="NSLocationAlwaysUsageDescription" 
file="*-Info.plist" mode="merge">
         <string>Necessita da sua localização para indicar o endereço da 
ocorrência a ser enviada ao seu município</string>
       </edit-config>
       <edit-config target="NSLocationAlwaysAndWhenInUseUsageDescription" 
file="*-Info.plist" mode="merge">
         <string>Necessita da sua localização para indicar o endereço da 
ocorrência a ser enviada ao seu município</string>
       </edit-config>
       <edit-config target="NSCameraUsageDescription" file="*-Info.plist" 
mode="merge">
         <string>Necessita da acesso à câmera para tirar fotos às 
anomalias</string>
       </edit-config>
       <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" 
mode="merge">
         <string>Necessita da acesso à galeria, caso você já tenha tirado 
anteriormente a foto à ocorrência</string>
       </edit-config>
       <edit-config target="NSPhotoLibraryAddUsageDescription" 
file="*-Info.plist" mode="merge">
         <string>Necessita da acesso à galeria para guardar algumas fotos, 
mesmo que temporariamente</string>
       </edit-config>
       <edit-config target="UIFileSharingEnabled" file="*-Info.plist" 
mode="merge">
         <true/>
       </edit-config>
       <edit-config target="LSSupportsOpeningDocumentsInPlace" 
file="*-Info.plist" mode="merge">
         <true/>
       </edit-config>
       <edit-config target="UISupportsDocumentBrowser" file="*-Info.plist" 
mode="merge">
         <true/>
       </edit-config>
     </platform>
   </widget>
   ```
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to