spoonconsulting / cordova-plugin-background-upload

Cordova plugin for background upload
Apache License 2.0
49 stars 53 forks source link

compatibility with cordova-plugin-file v7.0.0 #252

Open MaximBelov opened 1 year ago

zfir commented 1 year ago

Hello @MaximBelov,

This version of cordova-plugin-file has a problem when displaying an img in the WebView.

https://github.com/apache/cordova-plugin-file/issues/526

The link above address this issue.

MaximBelov commented 1 year ago

Hi @zfir My fix is working fine with

Example

  // filePath - full path
  // compatibleSrc - for view
  getLocalFileParams(fileName: string) {
    const filePath = `${this.file.dataDirectory}/${fileName}`;
    const compatibleSrc = this.webview.convertFileSrc(filePath);
    return {
      filePath,
      compatibleSrc,
    };
  }

  const payload = {
    fileKey: 'file',
    notificationTitle: 'Uploading files',
    id,
    filePath: this.getLocalFileParams(file).filePath,
    serverUrl: filesParams[id].attributes.action,
    parameters: filesParams[id].inputs,
  };
  this.fileTransferManager.startUpload({ ...payload });
zfir commented 1 year ago

Hello @MaximBelov,

Tested your PR along with the update for cordova-plugin-file to 7.0.0.

Still cannot display img HTML tags

MaximBelov commented 1 year ago

please share your demo project

zfir commented 1 year ago

It's a private project. Have you added img HTML tags in your project?

MaximBelov commented 1 year ago

yes I added img tags

<ion-img [src]="img.value"

https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/img/img.tsx#L115


You can check the demo project https://github.com/MaximBelov/cordova-plugin-background-upload/commits/compability-cordova-file-7-lab

android https://monosnap.com/file/XbQomCIDENc8KxuyczgPALPJLLNL9l

ios https://monosnap.com/file/1rTER5pa1sU6MfFONAMYT86mll8jrZ

zfir commented 1 year ago

Hello @MaximBelov,

For me, I am using img and not ion-img, maybe that's the problem.

Will look into that and merge if good.

zfir commented 1 year ago

Hello @MaximBelov,

Did some tests with ion-img, not able to display the image still. Do you have a example where you are using ion-img?

MaximBelov commented 1 year ago

Hi @zfir Demo here

https://github.com/MaximBelov/cordova-plugin-background-upload/commits/compability-cordova-file-7-lab