@sumaris-net/ngx-components 1.19.4 → 1.19.5-rc1

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.
@@ -17888,6 +17888,252 @@
17888
17888
  ]; };
17889
17889
  var templateObject_1$1, templateObject_2$1, templateObject_3$1, templateObject_4$1, templateObject_5$1;
17890
17890
 
17891
+ var UploadFile = /** @class */ (function (_super) {
17892
+ __extends(UploadFile, _super);
17893
+ function UploadFile() {
17894
+ return _super !== null && _super.apply(this, arguments) || this;
17895
+ }
17896
+ return UploadFile;
17897
+ }(File));
17898
+ var FileResponse = /** @class */ (function () {
17899
+ function FileResponse(init) {
17900
+ this.type = i2$1.HttpEventType.Response;
17901
+ this.body = isNotNil(init === null || init === void 0 ? void 0 : init.body) ? init.body : null;
17902
+ this.status = (init === null || init === void 0 ? void 0 : init.status) || 0;
17903
+ this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
17904
+ }
17905
+ return FileResponse;
17906
+ }());
17907
+ function isProgressEvent(event) {
17908
+ return event && (event.type === i2$1.HttpEventType.UploadProgress
17909
+ || event.type === i2$1.HttpEventType.DownloadProgress);
17910
+ }
17911
+ function isResponseEvent(event) {
17912
+ return event && event.type === i2$1.HttpEventType.Response;
17913
+ }
17914
+
17915
+ var UploadFilePopover = /** @class */ (function () {
17916
+ function UploadFilePopover(popoverController, translate, cd) {
17917
+ this.popoverController = popoverController;
17918
+ this.translate = translate;
17919
+ this.cd = cd;
17920
+ this.uniqueFile = false;
17921
+ this.instantUpload = false;
17922
+ this.importing = false;
17923
+ }
17924
+ Object.defineProperty(UploadFilePopover.prototype, "files", {
17925
+ get: function () {
17926
+ return this.uploader.files;
17927
+ },
17928
+ enumerable: false,
17929
+ configurable: true
17930
+ });
17931
+ Object.defineProperty(UploadFilePopover.prototype, "disabled", {
17932
+ get: function () {
17933
+ return this.importing || isEmptyArray(this.files);
17934
+ },
17935
+ enumerable: false,
17936
+ configurable: true
17937
+ });
17938
+ Object.defineProperty(UploadFilePopover.prototype, "valid", {
17939
+ get: function () {
17940
+ return isNotEmptyArray(this.files);
17941
+ },
17942
+ enumerable: false,
17943
+ configurable: true
17944
+ });
17945
+ UploadFilePopover.prototype.onValidate = function (event) {
17946
+ return __awaiter(this, void 0, void 0, function () {
17947
+ var files, errors, err_1;
17948
+ return __generator(this, function (_a) {
17949
+ switch (_a.label) {
17950
+ case 0:
17951
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
17952
+ // Avoid multiple call
17953
+ if (this.importing)
17954
+ return [2 /*return*/];
17955
+ console.debug('[upload-file-popover] Validate form: will upload all files...');
17956
+ _a.label = 1;
17957
+ case 1:
17958
+ _a.trys.push([1, , 8, 9]);
17959
+ this.importing = true;
17960
+ this.resetError();
17961
+ _a.label = 2;
17962
+ case 2:
17963
+ _a.trys.push([2, 6, , 7]);
17964
+ // Wait processing files finished
17965
+ return [4 /*yield*/, this.uploader.waitIdle()];
17966
+ case 3:
17967
+ // Wait processing files finished
17968
+ _a.sent();
17969
+ // upload all files
17970
+ return [4 /*yield*/, this.uploader.uploadFiles()];
17971
+ case 4:
17972
+ // upload all files
17973
+ _a.sent();
17974
+ files = (this.uploader.processedFiles || [])
17975
+ .filter(function (file) { return !file.deleting; });
17976
+ // Nothing to upload: close popover
17977
+ if (isEmptyArray(files))
17978
+ return [2 /*return*/, this.cancel()];
17979
+ errors = files.map(function (file) { return file.error; }).filter(isNotNilOrBlank);
17980
+ // If error: stop
17981
+ if (errors.length) {
17982
+ errors.forEach(function (error) { return console.error(error); });
17983
+ throw { message: 'FILE.UPLOAD.ERROR' };
17984
+ }
17985
+ // return files
17986
+ return [4 /*yield*/, this.popoverController.dismiss(files)];
17987
+ case 5:
17988
+ // return files
17989
+ _a.sent();
17990
+ return [3 /*break*/, 7];
17991
+ case 6:
17992
+ err_1 = _a.sent();
17993
+ this.error = (err_1 && err_1.message) || err_1;
17994
+ return [3 /*break*/, 7];
17995
+ case 7: return [3 /*break*/, 9];
17996
+ case 8:
17997
+ this.importing = false;
17998
+ this.cd.markForCheck();
17999
+ return [7 /*endfinally*/];
18000
+ case 9: return [2 /*return*/];
18001
+ }
18002
+ });
18003
+ });
18004
+ };
18005
+ UploadFilePopover.prototype.cancel = function () {
18006
+ return this.popoverController.dismiss();
18007
+ };
18008
+ UploadFilePopover.prototype.resetError = function () {
18009
+ if (this.error) {
18010
+ this.error = null;
18011
+ this.cd.markForCheck();
18012
+ }
18013
+ };
18014
+ return UploadFilePopover;
18015
+ }());
18016
+ UploadFilePopover.decorators = [
18017
+ { type: i0.Component, args: [{
18018
+ selector: 'app-upload-file-popover',
18019
+ template: "\n<ion-content class=\"ion-no-padding\" scrollY=\"false\">\n <div class=\"modal-content\">\n <app-upload-file\n #uploader\n [uploadFn]=\"uploadFn\"\n [deleteFn]=\"deleteFn\"\n [fileExtension]=\"fileExtension\"\n [instantUpload]=\"instantUpload\"\n [uniqueFile]=\"uniqueFile\"\n [maxParallelUpload]=\"maxParallelUpload\"\n ></app-upload-file>\n </div>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n <div *ngIf=\"importing\" class=\"importing-info\">\n <ion-text color=\"medium\"><small translate>FILE.UPLOAD.IMPORTING</small></ion-text>\n &nbsp;<ion-spinner name=\"dots\" color=\"accent\"></ion-spinner>\n </div>\n <ion-item *ngIf=\"error\" lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"ion-text-wrap\" [innerHTML]=\"error | translate\"></ion-label>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\">\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"cancel()\">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n <ion-button\n [fill]=\"disabled ? 'clear' : 'solid'\"\n (click)=\"onValidate($event)\"\n (keyup.enter)=\"onValidate($event)\"\n color=\"tertiary\"\n [disabled]=\"disabled\"\n >\n <ion-label translate>COMMON.BTN_IMPORT</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n",
18020
+ encapsulation: i0.ViewEncapsulation.None,
18021
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
18022
+ styles: [".importing-info{-webkit-padding-start:var(--ion-padding);padding-inline-start:var(--ion-padding);display:inline-flex;flex-wrap:nowrap;padding-top:8px}"]
18023
+ },] }
18024
+ ];
18025
+ UploadFilePopover.ctorParameters = function () { return [
18026
+ { type: i1$5.PopoverController },
18027
+ { type: i1$2.TranslateService },
18028
+ { type: i0.ChangeDetectorRef }
18029
+ ]; };
18030
+ UploadFilePopover.propDecorators = {
18031
+ uploader: [{ type: i0.ViewChild, args: ['uploader', { static: true },] }],
18032
+ fileExtension: [{ type: i0.Input }],
18033
+ title: [{ type: i0.Input }],
18034
+ uniqueFile: [{ type: i0.Input }],
18035
+ instantUpload: [{ type: i0.Input }],
18036
+ uploadFn: [{ type: i0.Input }],
18037
+ deleteFn: [{ type: i0.Input }],
18038
+ maxParallelUpload: [{ type: i0.Input }]
18039
+ };
18040
+
18041
+ var MimeTypes = Object.freeze({
18042
+ ANDROID_APK: 'application/vnd.android.package-archive'
18043
+ });
18044
+ var FilesUtils = /** @class */ (function () {
18045
+ function FilesUtils() {
18046
+ }
18047
+ FilesUtils.showUploadPopover = function (popoverController, event, opts) {
18048
+ return __awaiter(this, void 0, void 0, function () {
18049
+ var modal, _a, data, role;
18050
+ return __generator(this, function (_b) {
18051
+ switch (_b.label) {
18052
+ case 0: return [4 /*yield*/, popoverController.create({
18053
+ component: UploadFilePopover,
18054
+ componentProps: opts,
18055
+ backdropDismiss: false,
18056
+ keyboardClose: false,
18057
+ event: event,
18058
+ translucent: true,
18059
+ cssClass: 'popover-large',
18060
+ })];
18061
+ case 1:
18062
+ modal = _b.sent();
18063
+ return [4 /*yield*/, modal.present()];
18064
+ case 2:
18065
+ _b.sent();
18066
+ return [4 /*yield*/, modal.onDidDismiss()];
18067
+ case 3:
18068
+ _a = _b.sent(), data = _a.data, role = _a.role;
18069
+ return [2 /*return*/, {
18070
+ role: role,
18071
+ data: data ? data : undefined
18072
+ }];
18073
+ }
18074
+ });
18075
+ });
18076
+ };
18077
+ FilesUtils.readAsText = function (file, encoding) {
18078
+ var $progress = new rxjs.Subject();
18079
+ var reader = new FileReader();
18080
+ encoding = (encoding || 'UTF-8').toLowerCase();
18081
+ // Listen progress
18082
+ reader.onprogress = function (e) {
18083
+ var total = e.total || 1;
18084
+ var loaded = e.total || 0;
18085
+ if (loaded < total)
18086
+ $progress.next({ type: i2$1.HttpEventType.UploadProgress, loaded: loaded, total: total });
18087
+ };
18088
+ // Listen end
18089
+ reader.onloadend = function (e) {
18090
+ var body = reader.result;
18091
+ if (typeof body === 'string') {
18092
+ $progress.next(new FileResponse({ body: body }));
18093
+ $progress.complete();
18094
+ }
18095
+ else {
18096
+ console.error("Cannot read file '" + file.name + "' as text");
18097
+ $progress.error("Cannot read file as text");
18098
+ }
18099
+ };
18100
+ // Listen error
18101
+ reader.onerror = function (event) {
18102
+ console.error('[files] Error while reading file:', event);
18103
+ $progress.error(event);
18104
+ };
18105
+ // Start reading the file
18106
+ reader.readAsText(file, encoding);
18107
+ return $progress.asObservable();
18108
+ };
18109
+ return FilesUtils;
18110
+ }());
18111
+ var UriUtils = /** @class */ (function () {
18112
+ function UriUtils() {
18113
+ }
18114
+ /**
18115
+ * Extract the filename, from an uri (using the last slash)
18116
+ * @param uri
18117
+ */
18118
+ UriUtils.getFilename = function (uri) {
18119
+ if (!uri)
18120
+ return uri;
18121
+ var filename = uri.trim();
18122
+ // Get last part (or all string, if no '/')
18123
+ var lastSlashIndex = filename.lastIndexOf('/');
18124
+ if (lastSlashIndex !== -1 && lastSlashIndex !== uri.length - 1) {
18125
+ filename = filename.substring(lastSlashIndex + 1);
18126
+ }
18127
+ // Remove query params
18128
+ var queryParamIndex = filename.indexOf('?');
18129
+ if (queryParamIndex !== -1) {
18130
+ filename = filename.substring(0, queryParamIndex);
18131
+ }
18132
+ return filename;
18133
+ };
18134
+ return UriUtils;
18135
+ }());
18136
+
17891
18137
  var moment$4 = momentImported__namespace;
17892
18138
  var AndroidOsEnvironment = Object.freeze({
17893
18139
  DIRECTORY_DOWNLOADS: 'Download',
@@ -18083,34 +18329,48 @@
18083
18329
  };
18084
18330
  PlatformService.prototype.download = function (request) {
18085
18331
  var _this = this;
18332
+ var _a, _b;
18086
18333
  if (!request || !request.uri)
18087
18334
  throw new Error('Missing argument \'request\' or \'request.uri\'');
18088
18335
  if (this._android && this.downloader) {
18089
18336
  // Check if not already downloading file
18090
- var location$ = this._downloadingJobs.get(request.uri);
18091
- if (location$)
18092
- return location$;
18093
- request = Object.assign(Object.assign({ visibleInDownloadsUi: true, notificationVisibility: ngx$6.NotificationVisibility.VisibleNotifyCompleted, title: request.title || request.filename }, request), { destinationInExternalPublicDir: Object.assign({ dirType: AndroidOsEnvironment.DIRECTORY_DOWNLOADS, subPath: request.filename || request.title || '' }, request.destinationInExternalPublicDir) });
18094
- console.debug('[platform] Downloading, using request: ' + JSON.stringify(request));
18337
+ var job$ = this._downloadingJobs.get(request.uri);
18338
+ if (job$)
18339
+ return job$;
18340
+ // Compute subPath (final filename)
18341
+ var subPath = ((_a = request.destinationInExternalPublicDir) === null || _a === void 0 ? void 0 : _a.subPath) || ((_b = request.destinationInExternalFilesDir) === null || _b === void 0 ? void 0 : _b.subPath)
18342
+ || request.filename || UriUtils.getFilename(request.uri)
18343
+ || request.title || 'download';
18344
+ subPath = subPath.toLowerCase()
18345
+ // Remove spaces
18346
+ .replace(/\s+/g, '-');
18347
+ // Force APK to finish with '.apk'
18348
+ if (request.mimeType === MimeTypes.ANDROID_APK && !subPath.toLowerCase().endsWith('.apk')) {
18349
+ subPath += '.apk';
18350
+ }
18351
+ var downloadRequest_1 = Object.assign(Object.assign({ visibleInDownloadsUi: true, notificationVisibility: ngx$6.NotificationVisibility.VisibleNotifyCompleted }, request), { filename: undefined, destinationInExternalPublicDir: !request.destinationInExternalFilesDir
18352
+ ? Object.assign(Object.assign({ dirType: AndroidOsEnvironment.DIRECTORY_DOWNLOADS }, request.destinationInExternalPublicDir), { subPath: subPath }) : undefined, destinationInExternalFilesDir: request.destinationInExternalFilesDir
18353
+ ? Object.assign(Object.assign({ dirType: AndroidOsEnvironment.DIRECTORY_DOWNLOADS }, request.destinationInExternalFilesDir), { subPath: subPath }) : undefined });
18095
18354
  // Start download
18096
- location$ = rxjs.from(this.downloader.download(request));
18355
+ console.debug('[platform] Downloading, using request: ' + JSON.stringify(downloadRequest_1));
18356
+ job$ = rxjs.from(this.downloader.download(downloadRequest_1));
18097
18357
  // Remember this request uri
18098
- this._downloadingJobs.set(request.uri, location$);
18099
- return location$
18358
+ this._downloadingJobs.set(downloadRequest_1.uri, job$);
18359
+ return job$
18100
18360
  .pipe(operators.tap(function (location) {
18101
18361
  console.info('[platform] File successfully downloaded at:' + location);
18102
- // Forget the request
18103
- _this._downloadingJobs.delete(request.uri);
18362
+ // Forget job
18363
+ _this._downloadingJobs.delete(downloadRequest_1.uri);
18104
18364
  return location;
18105
18365
  }), operators.catchError(function (err) {
18106
18366
  var _a;
18107
18367
  console.error('[platform] Unable to download: ' + (err && err.message || err));
18108
18368
  // Forget the request
18109
- _this._downloadingJobs.delete(request.uri);
18369
+ _this._downloadingJobs.delete(downloadRequest_1.uri);
18110
18370
  // Retry with another location - issue in older Android version
18111
- if (((_a = request.destinationInExternalPublicDir) === null || _a === void 0 ? void 0 : _a.dirType) === AndroidOsEnvironment.DIRECTORY_DOWNLOADS) {
18112
- request.destinationInExternalPublicDir.dirType = AndroidOsEnvironment.DIRECTORY_DOWNLOADS_OLD;
18113
- return _this.download(request);
18371
+ if (((_a = downloadRequest_1.destinationInExternalPublicDir) === null || _a === void 0 ? void 0 : _a.dirType) === AndroidOsEnvironment.DIRECTORY_DOWNLOADS) {
18372
+ downloadRequest_1.destinationInExternalPublicDir.dirType = AndroidOsEnvironment.DIRECTORY_DOWNLOADS_OLD;
18373
+ return _this.download(downloadRequest_1);
18114
18374
  }
18115
18375
  throw err;
18116
18376
  }));
@@ -18526,30 +18786,6 @@
18526
18786
  { type: i1$2.TranslateService }
18527
18787
  ]; };
18528
18788
 
18529
- var UploadFile = /** @class */ (function (_super) {
18530
- __extends(UploadFile, _super);
18531
- function UploadFile() {
18532
- return _super !== null && _super.apply(this, arguments) || this;
18533
- }
18534
- return UploadFile;
18535
- }(File));
18536
- var FileResponse = /** @class */ (function () {
18537
- function FileResponse(init) {
18538
- this.type = i2$1.HttpEventType.Response;
18539
- this.body = isNotNil(init === null || init === void 0 ? void 0 : init.body) ? init.body : null;
18540
- this.status = (init === null || init === void 0 ? void 0 : init.status) || 0;
18541
- this.statusText = (init === null || init === void 0 ? void 0 : init.statusText) || 'OK';
18542
- }
18543
- return FileResponse;
18544
- }());
18545
- function isProgressEvent(event) {
18546
- return event && (event.type === i2$1.HttpEventType.UploadProgress
18547
- || event.type === i2$1.HttpEventType.DownloadProgress);
18548
- }
18549
- function isResponseEvent(event) {
18550
- return event && event.type === i2$1.HttpEventType.Response;
18551
- }
18552
-
18553
18789
  var UploadFileComponent = /** @class */ (function () {
18554
18790
  function UploadFileComponent(cd, translate) {
18555
18791
  this.cd = cd;
@@ -18778,132 +19014,6 @@
18778
19014
  maxParallelUpload: [{ type: i0.Input }]
18779
19015
  };
18780
19016
 
18781
- var UploadFilePopover = /** @class */ (function () {
18782
- function UploadFilePopover(popoverController, translate, cd) {
18783
- this.popoverController = popoverController;
18784
- this.translate = translate;
18785
- this.cd = cd;
18786
- this.uniqueFile = false;
18787
- this.instantUpload = false;
18788
- this.importing = false;
18789
- }
18790
- Object.defineProperty(UploadFilePopover.prototype, "files", {
18791
- get: function () {
18792
- return this.uploader.files;
18793
- },
18794
- enumerable: false,
18795
- configurable: true
18796
- });
18797
- Object.defineProperty(UploadFilePopover.prototype, "disabled", {
18798
- get: function () {
18799
- return this.importing || isEmptyArray(this.files);
18800
- },
18801
- enumerable: false,
18802
- configurable: true
18803
- });
18804
- Object.defineProperty(UploadFilePopover.prototype, "valid", {
18805
- get: function () {
18806
- return isNotEmptyArray(this.files);
18807
- },
18808
- enumerable: false,
18809
- configurable: true
18810
- });
18811
- UploadFilePopover.prototype.onValidate = function (event) {
18812
- return __awaiter(this, void 0, void 0, function () {
18813
- var files, errors, err_1;
18814
- return __generator(this, function (_a) {
18815
- switch (_a.label) {
18816
- case 0:
18817
- event === null || event === void 0 ? void 0 : event.stopPropagation();
18818
- // Avoid multiple call
18819
- if (this.importing)
18820
- return [2 /*return*/];
18821
- console.debug('[upload-file-popover] Validate form: will upload all files...');
18822
- _a.label = 1;
18823
- case 1:
18824
- _a.trys.push([1, , 8, 9]);
18825
- this.importing = true;
18826
- this.resetError();
18827
- _a.label = 2;
18828
- case 2:
18829
- _a.trys.push([2, 6, , 7]);
18830
- // Wait processing files finished
18831
- return [4 /*yield*/, this.uploader.waitIdle()];
18832
- case 3:
18833
- // Wait processing files finished
18834
- _a.sent();
18835
- // upload all files
18836
- return [4 /*yield*/, this.uploader.uploadFiles()];
18837
- case 4:
18838
- // upload all files
18839
- _a.sent();
18840
- files = (this.uploader.processedFiles || [])
18841
- .filter(function (file) { return !file.deleting; });
18842
- // Nothing to upload: close popover
18843
- if (isEmptyArray(files))
18844
- return [2 /*return*/, this.cancel()];
18845
- errors = files.map(function (file) { return file.error; }).filter(isNotNilOrBlank);
18846
- // If error: stop
18847
- if (errors.length) {
18848
- errors.forEach(function (error) { return console.error(error); });
18849
- throw { message: 'FILE.UPLOAD.ERROR' };
18850
- }
18851
- // return files
18852
- return [4 /*yield*/, this.popoverController.dismiss(files)];
18853
- case 5:
18854
- // return files
18855
- _a.sent();
18856
- return [3 /*break*/, 7];
18857
- case 6:
18858
- err_1 = _a.sent();
18859
- this.error = (err_1 && err_1.message) || err_1;
18860
- return [3 /*break*/, 7];
18861
- case 7: return [3 /*break*/, 9];
18862
- case 8:
18863
- this.importing = false;
18864
- this.cd.markForCheck();
18865
- return [7 /*endfinally*/];
18866
- case 9: return [2 /*return*/];
18867
- }
18868
- });
18869
- });
18870
- };
18871
- UploadFilePopover.prototype.cancel = function () {
18872
- return this.popoverController.dismiss();
18873
- };
18874
- UploadFilePopover.prototype.resetError = function () {
18875
- if (this.error) {
18876
- this.error = null;
18877
- this.cd.markForCheck();
18878
- }
18879
- };
18880
- return UploadFilePopover;
18881
- }());
18882
- UploadFilePopover.decorators = [
18883
- { type: i0.Component, args: [{
18884
- selector: 'app-upload-file-popover',
18885
- template: "\n<ion-content class=\"ion-no-padding\" scrollY=\"false\">\n <div class=\"modal-content\">\n <app-upload-file\n #uploader\n [uploadFn]=\"uploadFn\"\n [deleteFn]=\"deleteFn\"\n [fileExtension]=\"fileExtension\"\n [instantUpload]=\"instantUpload\"\n [uniqueFile]=\"uniqueFile\"\n [maxParallelUpload]=\"maxParallelUpload\"\n ></app-upload-file>\n </div>\n</ion-content>\n\n<ion-footer>\n <ion-toolbar>\n <ion-row class=\"ion-no-padding\" nowrap>\n <ion-col>\n <div *ngIf=\"importing\" class=\"importing-info\">\n <ion-text color=\"medium\"><small translate>FILE.UPLOAD.IMPORTING</small></ion-text>\n &nbsp;<ion-spinner name=\"dots\" color=\"accent\"></ion-spinner>\n </div>\n <ion-item *ngIf=\"error\" lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"ion-text-wrap\" [innerHTML]=\"error | translate\"></ion-label>\n </ion-item>\n </ion-col>\n <ion-col size=\"auto\">\n <ion-button fill=\"clear\" color=\"dark\" (click)=\"cancel()\">\n <ion-label translate>COMMON.BTN_CANCEL</ion-label>\n </ion-button>\n <ion-button\n [fill]=\"disabled ? 'clear' : 'solid'\"\n (click)=\"onValidate($event)\"\n (keyup.enter)=\"onValidate($event)\"\n color=\"tertiary\"\n [disabled]=\"disabled\"\n >\n <ion-label translate>COMMON.BTN_IMPORT</ion-label>\n </ion-button>\n </ion-col>\n </ion-row>\n </ion-toolbar>\n</ion-footer>\n",
18886
- encapsulation: i0.ViewEncapsulation.None,
18887
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
18888
- styles: [".importing-info{-webkit-padding-start:var(--ion-padding);padding-inline-start:var(--ion-padding);display:inline-flex;flex-wrap:nowrap;padding-top:8px}"]
18889
- },] }
18890
- ];
18891
- UploadFilePopover.ctorParameters = function () { return [
18892
- { type: i1$5.PopoverController },
18893
- { type: i1$2.TranslateService },
18894
- { type: i0.ChangeDetectorRef }
18895
- ]; };
18896
- UploadFilePopover.propDecorators = {
18897
- uploader: [{ type: i0.ViewChild, args: ['uploader', { static: true },] }],
18898
- fileExtension: [{ type: i0.Input }],
18899
- title: [{ type: i0.Input }],
18900
- uniqueFile: [{ type: i0.Input }],
18901
- instantUpload: [{ type: i0.Input }],
18902
- uploadFn: [{ type: i0.Input }],
18903
- deleteFn: [{ type: i0.Input }],
18904
- maxParallelUpload: [{ type: i0.Input }]
18905
- };
18906
-
18907
19017
  var APP_TESTING_PAGES = new i0.InjectionToken('testingPages');
18908
19018
  var SharedTestsPage = /** @class */ (function () {
18909
19019
  function SharedTestsPage(route, router, translate, pages) {
@@ -20498,74 +20608,6 @@
20498
20608
  return JobUtils;
20499
20609
  }());
20500
20610
 
20501
- var FilesUtils = /** @class */ (function () {
20502
- function FilesUtils() {
20503
- }
20504
- FilesUtils.showUploadPopover = function (popoverController, event, opts) {
20505
- return __awaiter(this, void 0, void 0, function () {
20506
- var modal, _a, data, role;
20507
- return __generator(this, function (_b) {
20508
- switch (_b.label) {
20509
- case 0: return [4 /*yield*/, popoverController.create({
20510
- component: UploadFilePopover,
20511
- componentProps: opts,
20512
- backdropDismiss: false,
20513
- keyboardClose: false,
20514
- event: event,
20515
- translucent: true,
20516
- cssClass: 'popover-large',
20517
- })];
20518
- case 1:
20519
- modal = _b.sent();
20520
- return [4 /*yield*/, modal.present()];
20521
- case 2:
20522
- _b.sent();
20523
- return [4 /*yield*/, modal.onDidDismiss()];
20524
- case 3:
20525
- _a = _b.sent(), data = _a.data, role = _a.role;
20526
- return [2 /*return*/, {
20527
- role: role,
20528
- data: data ? data : undefined
20529
- }];
20530
- }
20531
- });
20532
- });
20533
- };
20534
- FilesUtils.readAsText = function (file, encoding) {
20535
- var $progress = new rxjs.Subject();
20536
- var reader = new FileReader();
20537
- encoding = (encoding || 'UTF-8').toLowerCase();
20538
- // Listen progress
20539
- reader.onprogress = function (e) {
20540
- var total = e.total || 1;
20541
- var loaded = e.total || 0;
20542
- if (loaded < total)
20543
- $progress.next({ type: i2$1.HttpEventType.UploadProgress, loaded: loaded, total: total });
20544
- };
20545
- // Listen end
20546
- reader.onloadend = function (e) {
20547
- var body = reader.result;
20548
- if (typeof body === 'string') {
20549
- $progress.next(new FileResponse({ body: body }));
20550
- $progress.complete();
20551
- }
20552
- else {
20553
- console.error("Cannot read file '" + file.name + "' as text");
20554
- $progress.error("Cannot read file as text");
20555
- }
20556
- };
20557
- // Listen error
20558
- reader.onerror = function (event) {
20559
- console.error('[files] Error while reading file:', event);
20560
- $progress.error(event);
20561
- };
20562
- // Start reading the file
20563
- reader.readAsText(file, encoding);
20564
- return $progress.asObservable();
20565
- };
20566
- return FilesUtils;
20567
- }());
20568
-
20569
20611
  /**
20570
20612
  * Define here theme colors
20571
20613
  */
@@ -23215,9 +23257,6 @@
23215
23257
  { type: i0.Injectable, args: [{ providedIn: 'root' },] }
23216
23258
  ];
23217
23259
 
23218
- var MimeTypes = Object.freeze({
23219
- ANDROID_APK: 'application/vnd.android.package-archive'
23220
- });
23221
23260
  var AppInstallUpgradeCard = /** @class */ (function () {
23222
23261
  function AppInstallUpgradeCard(modalCtrl, configService, toastController, alertController, translate, cd, platform, network, environment) {
23223
23262
  this.modalCtrl = modalCtrl;
@@ -23464,10 +23503,10 @@
23464
23503
  var title = void 0;
23465
23504
  var mimeType = void 0;
23466
23505
  // Get file name
23467
- var filename = this.getFilename(url);
23506
+ var filename = UriUtils.getFilename(url);
23468
23507
  var version = minVersion || 'latest';
23469
23508
  // OK, this is a downloadable APK file (e.g. NOT a link to a playstore)
23470
- if (filename === null || filename === void 0 ? void 0 : filename.endsWith('.apk')) {
23509
+ if (filename === null || filename === void 0 ? void 0 : filename.toLowerCase().endsWith('.apk')) {
23471
23510
  // Define mime type
23472
23511
  mimeType = MimeTypes.ANDROID_APK;
23473
23512
  // Get the file version (if any)
@@ -23478,11 +23517,9 @@
23478
23517
  filename = (name + "-v" + version + ".apk").toLowerCase();
23479
23518
  title = name + " v" + version;
23480
23519
  }
23481
- else {
23482
- // Replace 'latest' with the app version, if present
23483
- if (filename.indexOf('latest')) {
23484
- filename = filename.replace('latest', version);
23485
- }
23520
+ // Replace 'latest' with the app version, if present in the filename
23521
+ else if (filename.indexOf('latest') && version !== 'latest') {
23522
+ filename = filename.replace('latest', version);
23486
23523
  }
23487
23524
  }
23488
23525
  result.push({ name: name, url: url, platform: 'android', version: version, filename: filename, title: title, mimeType: mimeType });
@@ -23494,18 +23531,6 @@
23494
23531
  //}
23495
23532
  return result;
23496
23533
  };
23497
- AppInstallUpgradeCard.prototype.getFilename = function (url) {
23498
- if (!url)
23499
- return;
23500
- // Get last part (or all string, if no '/')
23501
- var filename = url.substring(url.lastIndexOf('/') + 1);
23502
- var queryParamIndex = filename.indexOf('?');
23503
- if (queryParamIndex !== -1) {
23504
- // Remove query params
23505
- return filename.substring(0, queryParamIndex);
23506
- }
23507
- return filename;
23508
- };
23509
23534
  AppInstallUpgradeCard.prototype.listenDownloadJobs = function () {
23510
23535
  var _this = this;
23511
23536
  // Listening downloading promise, if exists
@@ -25266,7 +25291,7 @@
25266
25291
  updateDatasource: { get: function () { return _super_1.prototype.updateDatasource; } }
25267
25292
  });
25268
25293
  return __awaiter(this, void 0, void 0, function () {
25269
- var res, existingData;
25294
+ var fetchMoreFn, res, existingData;
25270
25295
  return __generator(this, function (_a) {
25271
25296
  switch (_a.label) {
25272
25297
  case 0:
@@ -25276,9 +25301,9 @@
25276
25301
  console.warn('Cannot fetch more because still editing row');
25277
25302
  return [2 /*return*/];
25278
25303
  }
25279
- // Fetch next page
25280
- this._fetchMoreFn = null; // Avoid multiple call
25281
- return [4 /*yield*/, this._fetchMoreFn()];
25304
+ fetchMoreFn = this._fetchMoreFn;
25305
+ this._fetchMoreFn = null;
25306
+ return [4 /*yield*/, fetchMoreFn()];
25282
25307
  case 1:
25283
25308
  res = _a.sent();
25284
25309
  // Skip if empty (no more data)
@@ -31974,6 +31999,7 @@
31974
31999
  exports.MessageService = MessageService;
31975
32000
  exports.MessageTypeList = MessageTypeList;
31976
32001
  exports.MessageTypes = MessageTypes;
32002
+ exports.MimeTypes = MimeTypes;
31977
32003
  exports.ModalToolbarComponent = ModalToolbarComponent;
31978
32004
  exports.NetworkService = NetworkService;
31979
32005
  exports.NgInitDirective = NgInitDirective;
@@ -32058,6 +32084,7 @@
32058
32084
  exports.UploadFilePopover = UploadFilePopover;
32059
32085
  exports.UploadFileTestingModule = UploadFileTestingModule;
32060
32086
  exports.UploadFileTestingPage = UploadFileTestingPage;
32087
+ exports.UriUtils = UriUtils;
32061
32088
  exports.UserEventFragments = UserEventFragments;
32062
32089
  exports.UserEventService = UserEventService;
32063
32090
  exports.UserEventTypes = UserEventTypes;