testeModals

This commit is contained in:
ivan gomes
2021-11-23 10:57:07 +01:00
parent 5ebb8ceefe
commit 6ace9c25e5
11 changed files with 127 additions and 20 deletions
-15
View File
@@ -2958,21 +2958,6 @@
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/crop": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/crop/-/crop-5.36.0.tgz",
"integrity": "sha512-wRO8J9oSHl4klvPMti7MTYjFCl6dYHYlbe56gzImf1pwfKQ7gmusskeedABfZggPV1NHruMBKUNALdatJf603A==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/fcm": {
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/@ionic-native/fcm/-/fcm-5.36.0.tgz",
+4
View File
@@ -215,6 +215,10 @@ const routes = [
{
path: 'video-allowed',
loadChildren: () => import('./modals/video-allowed/video-allowed.module').then( m => m.VideoAllowedPageModule)
},
{
path: 'preview-photo',
loadChildren: () => import('./modals/preview-photo/preview-photo.module').then( m => m.PreviewPhotoPageModule)
},
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PreviewPhotoPage } from './preview-photo.page';
const routes: Routes = [
{
path: '',
component: PreviewPhotoPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class PreviewPhotoPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { PreviewPhotoPageRoutingModule } from './preview-photo-routing.module';
import { PreviewPhotoPage } from './preview-photo.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PreviewPhotoPageRoutingModule
],
declarations: [PreviewPhotoPage]
})
export class PreviewPhotoPageModule {}
@@ -0,0 +1,15 @@
<ion-header>
<ion-toolbar>
<ion-title>
<ion-icon></ion-icon>
</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<img src="{{image}}" />
<ion-footer>
<ion-icon></ion-icon>
<ion-icon></ion-icon>
</ion-footer>
</ion-content>
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { PreviewPhotoPage } from './preview-photo.page';
describe('PreviewPhotoPage', () => {
let component: PreviewPhotoPage;
let fixture: ComponentFixture<PreviewPhotoPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ PreviewPhotoPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(PreviewPhotoPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,33 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
@Component({
selector: 'app-preview-photo',
templateUrl: './preview-photo.page.html',
styleUrls: ['./preview-photo.page.scss'],
})
export class PreviewPhotoPage implements OnInit {
constructor(private modalController: ModalController,
private navParams:NavParams) { }
ngOnInit() {
}
image: any;
exit( ){ this.modalController.dismiss()
}
save(img){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
}
+13 -1
View File
@@ -39,8 +39,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
/* @ViewChild('messageContainer') messageContainer: ElementRef; */
@ViewChild('rectangle') private rectangle: ElementRef;
canvas: any
ctx: any
loggedUser: any;
message = '';
messages:any;
userPresence='';
@@ -635,6 +636,7 @@ touchStart(card) {
card.el.style['z-index'] = 11;
}
async openPreview(msg) {
const modal = await this.modalController.create({
component: PreviewCameraPage,
@@ -658,6 +660,16 @@ touchStart(card) {
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
getPicture(img){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
canvas.width=300
canvas.height=234
ctx.drawImage(img.attachments[0].image_url, 0, 0, 300, 234);
document.body.appendChild(canvas);
}
}
@@ -461,7 +461,5 @@ export class PublicationsPage implements OnInit {
// newImage => console.log('new image path is: ' + newImage),
// error => console.error('Error cropping image', error)
// );
}
+1 -2
View File
@@ -240,7 +240,6 @@ export class FileService {
//this.capturedImage = this.capturedImage;
}
@@ -250,7 +249,7 @@ export class FileService {
quality: 50,
// allowEditing: true,
resultType: CameraResultType.Uri,
source: CameraSource.Photos
source: CameraSource.Camera
});