Skip to content

Commit

Permalink
chore: code tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismclarke committed Mar 1, 2025
1 parent e8a0425 commit 3cc499f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libs/shared/src/features/pdf-viewer/pdf-viewer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
<div class="h-full bg-[white]">
<ng-container *ngTemplateOutlet="customToolbar"></ng-container>
<div class="bg-[white] mt-4 p-8 text-center">
<div class="error-message">PDF Viewer not supported on this device</div>
<div>Please update to the latest version of chrome to enable</div>
<a mat-raised-button target="_blank" href="https://play.google.com/store/apps/details?id=com.android.chrome">
Update
<div class="error-message">{{ 'PDF Viewer not supported on this device' | translate }}</div>
<div>{{ 'Please install the latest version of Google Chrome and restart' | translate }}</div>
<a
class="mt-2"
mat-raised-button
target="_blank"
href="https://play.google.com/store/apps/details?id=com.android.chrome"
>
{{ 'Update' | translate }}
</a>
<button mat-raised-button (click)="restartApp()">{{ 'Restart App' | translate }}</button>
</div>
</div>

Expand Down
5 changes: 5 additions & 0 deletions libs/shared/src/features/pdf-viewer/pdf-viewer.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CommonModule } from '@angular/common';
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { App } from '@capacitor/app';
import { Capacitor } from '@capacitor/core';
import { pdfDefaultOptions, PDFScriptLoaderService } from 'ngx-extended-pdf-viewer';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
Expand Down Expand Up @@ -28,6 +29,10 @@ export class PdfViewerComponent {
this.runCompatibilityCheck();
}

public restartApp() {
App.exitApp();
}

private async runCompatibilityCheck() {
// use same check that ngx-extended-pdf calls when checking compatibility locally

Expand Down

0 comments on commit 3cc499f

Please sign in to comment.