microsoft / cordova-plugin-code-push

Cordova plugin for CodePush
http://appcenter.ms
Other
644 stars 328 forks source link

code-push has no effect on certain content #556

Open cszasz opened 4 years ago

cszasz commented 4 years ago

Hi,

I have the following scenario.

a.html includes a.js a.js in case it is running as an app in iOS reads a file b.txt from local filesystem:

function readFromFile(fileName, cb, fail) {
  var pathToFile = (cordova.file.applicationDirectory.startsWith('http') ? appServer : cordova.file.applicationDirectory +'www/')+ fileName;
  window.resolveLocalFileSystemURL(pathToFile, function (fileEntry) {
      fileEntry.file(function (file) {
          var reader = new FileReader();
          reader.onloadend = function (e) {
              cb(this.result);
          };

          reader.readAsText(file);
      });
  }, function(e) {
      fail();
  });

}

What I see is that if I make changes to a.html or a.js then code-push can update them, however if I make a change to b.txt, that has no effect, a.js will load the original version of b.txt.

I am using the following plugins:

cordova-plugin-camera       npm ^4.1.0  4.1.0   android,ios,winphone
cordova-plugin-camera-preview       npm ^0.11.0 0.11.0  android,ios,winphone
cordova-plugin-code-push    npm ^1.11.20    1.11.20 android,ios,winphone
cordova-plugin-file     npm ^6.0.2  6.0.2   android,ios,winphone
cordova-plugin-file-transfer    npm ^1.7.1  1.7.1   android,ios,winphone
cordova-plugin-geolocation      npm ^4.0.2  4.0.2   android,ios,winphone
cordova-plugin-inappbrowser     npm ^2.0.2  2.0.2   android,ios,winphone
cordova-plugin-splashscreen     npm ^5.0.3  5.0.3   android,ios,winphone
cordova-plugin-whitelist    npm ^1.3.4  1.3.4   android,ios,winphone
cordova-plugin-wkwebview-engine     npm ^1.2.1  1.2.1   android,ios,winphone
cordova-plugin-wkwebview-file-xhr       npm ^2.1.1  2.1.1   android,ios,winphone
cordova-plugin-zip      npm ^3.1.0  3.1.0   android,ios,winphone
cordova.plugins.diagnostic      npm ^5.0.0  5.0.0   android,ios,winphone
phonegap-plugin-barcodescanner      npm ^7.1.2  7.1.2   android,ios,winphone
phonegap-plugin-push    npm ^2.2.3  2.2.3   android,ios,winphone

Am I doing something wrong?

Could be that cordova-plugin-wkwebview-engine is the cause of the issue and that cordova-plugin-wkwebview-file-xhr is not intercepting these type of access to the filesystem?

Thanks, Csaba

cszasz commented 4 years ago

I made some further tests and it is clear that the same html page which is loaded through the browser if also loaded by xhr the content will be different after the update. The one which will be loaded by xhr will remain unchanged, the code-push has not effect on that file.