Refinamentos 1

This commit is contained in:
Paulo Pinto
2020-08-28 12:43:19 +01:00
parent 4c7dc5003e
commit e30e38f253
16 changed files with 16 additions and 152 deletions
@@ -7,10 +7,6 @@ const routes: Routes = [
{
path: '',
component: AttachmentsPage
},
{
path: 'viewer',
loadChildren: () => import('./viewer/viewer.module').then( m => m.ViewerPageModule)
}
];
@@ -3,8 +3,6 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { Attachment } from 'src/app/models/attachment.model';
import { ActivatedRoute, Router } from '@angular/router';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { AlertController, ModalController } from '@ionic/angular';
import { ViewerPage } from 'src/app/pages/events/attachments/viewer/viewer.page'
@Component({
selector: 'app-attachments',
@@ -16,7 +14,7 @@ export class AttachmentsPage implements OnInit {
loadedEventAttachments: Attachment[];
pageId: string;
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser, private route: Router, private modalCtrl: ModalController) { }
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser, private route: Router) { }
ngOnInit() {
/* Emit new data when something changes */
@@ -39,23 +37,9 @@ export class AttachmentsPage implements OnInit {
async viewDocument(documenturl:string)
{
//var ref = cordova.InAppBrowser.open(documenturl, '_blank', 'location=yes');
const browser = this.iab.create(documenturl, "_self")
const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer/branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
// const modal = await this.modalCtrl.create({
// component: ViewerPage,
// componentProps: {
// externalLink: documenturl
// },
// cssClass: 'viewer',
// backdropDismiss: false
// });
// await modal.present();
// modal.onDidDismiss();
}
navigateBack(){
@@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ViewerPage } from './viewer.page';
const routes: Routes = [
{
path: '',
component: ViewerPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ViewerPageRoutingModule {}
@@ -1,20 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ViewerPageRoutingModule } from './viewer-routing.module';
import { ViewerPage } from './viewer.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ViewerPageRoutingModule
],
declarations: [ViewerPage]
})
export class ViewerPageModule {}
@@ -1,22 +0,0 @@
<ion-header>
<ion-toolbar>
<ion-title>viewer</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<iframe class="e2e-iframe-untrusted-src" *ngIf="externalLink" [src]="externalLinkSanitized" width="100%" height="100%" frameborder="0"
sandbox="allow-scripts
allow-pointer-lock
allow-same-origin
allow-popups
allow-forms"></iframe>
<!-- <iframe class="e2e-iframe-untrusted-src" *ngIf="externalLink" [src]="externalLinkSanitized" width="100%" height="100%" frameborder="0"
sandbox="allow-presentation
allow-scripts
allow-top-navigation
allow-pointer-lock
allow-same-origin
allow-popups
allow-forms"></iframe> -->
</ion-content>
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ViewerPage } from './viewer.page';
describe('ViewerPage', () => {
let component: ViewerPage;
let fixture: ComponentFixture<ViewerPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewerPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ViewerPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,21 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
@Component({
selector: 'app-viewer',
templateUrl: './viewer.page.html',
styleUrls: ['./viewer.page.scss'],
})
export class ViewerPage implements OnInit {
externalLink: string;
externalLinkSanitized: SafeResourceUrl;
constructor(public sanitizer: DomSanitizer) { }
ngOnInit() {
this.externalLinkSanitized = this.sanitizer.bypassSecurityTrustResourceUrl(this.externalLink);
console.log(this.externalLinkSanitized);
}
}