MOBILE-3320 file: Fix file opened twice when second button clicked

main
Dani Palou 2021-06-09 08:23:16 +02:00
parent 365bd02fb5
commit 9dfe556066
2 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,7 @@
[canTrustDownload]="!alwaysDownload" (action)="download()" size="small">
</core-download-refresh>
<ion-button fill="clear" *ngIf="isDownloaded && isIOS" (click)="openFile(true)" color="dark"
<ion-button fill="clear" *ngIf="isDownloaded && isIOS" (click)="openFile($event, true)" color="dark"
[title]="openButtonLabel | translate">
<ion-icon slot="icon-only" [name]="openButtonIcon" aria-hidden="true"></ion-icon>
</ion-button>

View File

@ -144,10 +144,14 @@ export class CoreFileComponent implements OnInit, OnDestroy {
/**
* Convenience function to open a file, downloading it if needed.
*
* @param ev Click event (if any).
* @param isOpenButton Whether the open button was clicked.
* @return Promise resolved when file is opened.
*/
openFile(isOpenButton = false): Promise<void> {
openFile(ev?: Event, isOpenButton = false): Promise<void> {
ev?.preventDefault();
ev?.stopPropagation();
const options: CoreUtilsOpenFileOptions = {};
if (isOpenButton) {
// Use the non-default method.