@sumaris-net/ngx-components 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16773,6 +16773,9 @@
16773
16773
  enumerable: false,
16774
16774
  configurable: true
16775
16775
  });
16776
+ PlatformService.prototype.getCanOpenFile = function () {
16777
+ return isNotNil(this.fileOpener);
16778
+ };
16776
16779
  PlatformService.prototype.width = function () {
16777
16780
  return this.platform.width();
16778
16781
  };
@@ -16864,10 +16867,6 @@
16864
16867
  window.open(url, target, features, replace);
16865
16868
  }
16866
16869
  };
16867
- PlatformService.prototype.openFile = function (filePath, fileMimeType) {
16868
- console.debug("[platform] Opening file: " + filePath + " (" + fileMimeType + ") ...");
16869
- return this.fileOpener.open(filePath, fileMimeType);
16870
- };
16871
16870
  PlatformService.prototype.getDownloadingJob = function (uri) {
16872
16871
  return this._downloadingJobs.get(uri);
16873
16872
  };
@@ -16902,11 +16901,22 @@
16902
16901
  // Fallback (if not Android and Cordova): opening the URI using the browser
16903
16902
  // TODO: find a way to download under iOS (see https://www.c-sharpcorner.com/article/how-to-download-a-file-using-file-transfer-plugin-in-ionic-3/)
16904
16903
  else {
16905
- console.warn('[platform] Cannot use Android downloader: using browser open()');
16904
+ console.warn('[platform] Cannot use Cordova downloader plugin: using browser open()');
16906
16905
  this.open(request.uri, '_system', 'location=no', true);
16907
16906
  return rxjs.of();
16908
16907
  }
16909
16908
  };
16909
+ PlatformService.prototype.openFile = function (filePath, fileMimeType) {
16910
+ console.debug("[platform] Opening file: " + filePath + " (" + fileMimeType + ") ...");
16911
+ if (this.fileOpener) {
16912
+ return this.fileOpener.open(filePath, fileMimeType);
16913
+ }
16914
+ else {
16915
+ console.warn('[platform] Cannot use Cordova FileOpener plugin: using browser open()');
16916
+ this.open(filePath, '_system', 'location=no', true);
16917
+ return Promise.resolve();
16918
+ }
16919
+ };
16910
16920
  /* -- protected methods -- */
16911
16921
  PlatformService.prototype.configureCordovaPlugins = function (mobile) {
16912
16922
  console.info('[platform] Configuring Cordova plugins...');
@@ -21917,14 +21927,14 @@
21917
21927
  return __generator(this, function (_a) {
21918
21928
  switch (_a.label) {
21919
21929
  case 0:
21920
- if (!link || !link.location) {
21921
- console.error('[install-upgrade-card] Missing required argument \'link.location\'');
21930
+ if (!link || !link.location || !link.mimeType) {
21931
+ console.error('[install-upgrade-card] Missing required argument \'link.location\' or \'link.mimeType\'');
21922
21932
  return [2 /*return*/]; // Skip
21923
21933
  }
21924
21934
  _a.label = 1;
21925
21935
  case 1:
21926
21936
  _a.trys.push([1, 3, , 4]);
21927
- return [4 /*yield*/, this.platform.openFile(link.location, "application/vnd.android.package-archive")];
21937
+ return [4 /*yield*/, this.platform.openFile(link.location, link.mimeType)];
21928
21938
  case 2:
21929
21939
  _a.sent();
21930
21940
  return [3 /*break*/, 4];