2021-11-17 15:34:15 +01:00
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
|
|
import { IonSlides, ModalController, NavParams } from '@ionic/angular';
|
2021-11-18 13:01:53 +01:00
|
|
|
import { ImageCroppedEvent } from 'ngx-image-cropper';
|
2021-11-29 15:48:35 +01:00
|
|
|
import { PublicationsService } from 'src/app/services/publications.service';
|
2021-11-18 13:01:53 +01:00
|
|
|
import { GroupIconsPage } from '../group-icons/group-icons.page';
|
2021-11-30 12:30:58 +01:00
|
|
|
import { Share } from '@capacitor/share';
|
2021-11-30 17:56:56 +01:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
import { Directory, Filesystem } from '@capacitor/filesystem';
|
2021-11-17 15:34:15 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-preview-camera',
|
|
|
|
|
templateUrl: './preview-camera.page.html',
|
|
|
|
|
styleUrls: ['./preview-camera.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class PreviewCameraPage implements OnInit {
|
|
|
|
|
|
|
|
|
|
constructor( private modalController: ModalController,
|
2021-11-29 15:48:35 +01:00
|
|
|
private navParams:NavParams,
|
2021-11-30 17:56:56 +01:00
|
|
|
public router: Router,
|
2021-11-29 15:48:35 +01:00
|
|
|
private publicService: PublicationsService) { }
|
2021-11-17 15:34:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@ViewChild(IonSlides) slides : IonSlides
|
|
|
|
|
image: any;
|
2021-12-03 17:27:10 +01:00
|
|
|
name: string
|
2021-11-17 15:34:15 +01:00
|
|
|
_updatedAt: string
|
|
|
|
|
|
2021-11-18 13:01:53 +01:00
|
|
|
|
|
|
|
|
// myimage: null
|
|
|
|
|
// croppedImageBase64: any
|
|
|
|
|
|
2021-11-17 15:34:15 +01:00
|
|
|
// @Input('img') img: any
|
|
|
|
|
// @Input() username: string;
|
|
|
|
|
// @Input() date: string;
|
|
|
|
|
|
|
|
|
|
slideOpts = {
|
|
|
|
|
zoom: true
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.image = this.navParams.get('image')
|
2021-12-03 17:27:10 +01:00
|
|
|
this.name = this.navParams.get('username')
|
2021-11-17 15:34:15 +01:00
|
|
|
this._updatedAt = this.navParams.get('_updatedAt')
|
2022-06-29 15:51:28 +01:00
|
|
|
// console.log(this.image)
|
2021-11-18 13:01:53 +01:00
|
|
|
// this.image = this.myimage
|
2021-11-17 15:34:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ionViewDidEnter(){
|
|
|
|
|
this.slides.update()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async zoom(zoomIn: boolean){
|
|
|
|
|
const slider = await this.slides.getSwiper() //is swipper =!
|
|
|
|
|
const zoom = slider.zoom
|
|
|
|
|
zoomIn ? zoom.in(): zoom.out()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close(){
|
|
|
|
|
this.modalController.dismiss()
|
|
|
|
|
}
|
2021-11-18 13:01:53 +01:00
|
|
|
|
|
|
|
|
// imageCropped(ev: ImageCroppedEvent){
|
|
|
|
|
// this.croppedImageBase64 = ev.base64
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// async grupo(){
|
|
|
|
|
// const modal = await this.modalController.create({
|
|
|
|
|
// component: GroupIconsPage,
|
|
|
|
|
// cssClass: 'transparent-modal',
|
|
|
|
|
// });
|
|
|
|
|
// modal.present();
|
|
|
|
|
// }
|
2021-11-19 08:51:10 +01:00
|
|
|
|
|
|
|
|
async getIconGallery(){
|
|
|
|
|
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: GroupIconsPage ,
|
|
|
|
|
animated: true,
|
2021-11-29 15:48:35 +01:00
|
|
|
cssClass: 'transparent-modal',
|
2021-11-19 08:51:10 +01:00
|
|
|
});
|
|
|
|
|
modal.present();
|
|
|
|
|
}
|
2021-11-17 15:34:15 +01:00
|
|
|
|
2021-11-22 13:53:37 +01:00
|
|
|
openChat(){
|
2021-11-17 15:34:15 +01:00
|
|
|
|
2021-11-22 13:53:37 +01:00
|
|
|
|
2021-11-29 15:48:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clear() {
|
|
|
|
|
this.getIconGallery()
|
|
|
|
|
|
2021-11-23 16:05:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openChatVideo(){
|
|
|
|
|
|
2021-11-22 13:53:37 +01:00
|
|
|
}
|
2021-11-29 15:48:35 +01:00
|
|
|
deleteImage(){
|
2021-11-30 17:56:56 +01:00
|
|
|
document.addEventListener('DOMContentLoaded', ()=>{
|
|
|
|
|
document.querySelector('img').addEventListener('click',removeImage)
|
|
|
|
|
})
|
|
|
|
|
function removeImage(ev){
|
|
|
|
|
let img = ev.currentTarget
|
|
|
|
|
let src = ev.target.closest('.img')
|
|
|
|
|
src?.parentElement.removeChild(src)
|
|
|
|
|
|
2021-11-29 15:48:35 +01:00
|
|
|
}
|
2021-11-30 17:56:56 +01:00
|
|
|
}
|
|
|
|
|
|
2021-11-19 08:51:10 +01:00
|
|
|
|
2021-11-30 12:30:58 +01:00
|
|
|
async getIconShare(){
|
2021-11-30 17:56:56 +01:00
|
|
|
|
|
|
|
|
|
2021-11-30 12:30:58 +01:00
|
|
|
await Share.share({
|
|
|
|
|
title: 'See cool stuff',
|
|
|
|
|
text: 'Really awesome thing you need to see right meow',
|
2021-12-03 17:27:10 +01:00
|
|
|
url: "https://www.google.com/search?q=joao+louren%C3%A7o&rlz=1C1SQJL_pt-PTAO977AO977&sxsrf=AOaemvIEvXz_WiqNNapjaoE42Q8b71jtiA:1638355797910&source=lnms&tbm=isch&sa=X&sqi=2&ved=2ahUKEwjo9uX6tsL0AhXTlWoFHX1XAtcQ_AUoAXoECAMQAw&biw=1920&bih=937&dpr=1#imgrc=lH5UYZyhPKBhHM",
|
2021-11-30 12:30:58 +01:00
|
|
|
dialogTitle: 'Share with buddies',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 17:56:56 +01:00
|
|
|
redirPage(){
|
|
|
|
|
this.router.navigateByUrl('/chat')
|
|
|
|
|
}
|
2021-11-30 12:30:58 +01:00
|
|
|
|
2021-11-30 17:56:56 +01:00
|
|
|
async deleteFile(entry){
|
|
|
|
|
if(entry.isFile){
|
|
|
|
|
await Filesystem.deleteFile({
|
|
|
|
|
directory: Directory.Documents,
|
|
|
|
|
path: this.image.src + '/' + entry.name
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
await Filesystem.rmdir({
|
|
|
|
|
directory: Directory.Documents,
|
|
|
|
|
path: this.image.src + '/' + entry.name,
|
|
|
|
|
recursive:true //remove all file as well
|
|
|
|
|
})
|
|
|
|
|
}
|
2021-11-30 12:30:58 +01:00
|
|
|
|
2021-11-30 17:56:56 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-11-30 12:30:58 +01:00
|
|
|
|
2021-11-29 15:48:35 +01:00
|
|
|
|