From aca0d9cfed79c126c61ddc666eee48f129913223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 17 Nov 2021 11:01:47 +0100 Subject: [PATCH 1/9] Added filter in allprocess for Conhecimento tasks --- src/app/pages/gabinete-digital/gabinete-digital.page.ts | 1 + .../shared/gabinete-digital/all-processes/all-processes.page.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts index db593f0b1..96aa9f284 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts @@ -214,6 +214,7 @@ export class GabineteDigitalPage implements OnInit, DoCheck { let allProcessesList = await this.processesbackend.GetTasksList("", false).toPromise(); + allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento') if (!this.p.userRole(['PR'])) { allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Assinar Diplomas') diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts index 5ccb1343c..612988024 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.ts @@ -66,6 +66,8 @@ export class AllProcessesPage implements OnInit { let allProcessesList = await this.processesService.GetTasksList("", false).toPromise(); //console.log(allProcessesList); + allProcessesList = allProcessesList.filter(element => element.activityInstanceName != 'Conhecimento') + this.skeletonLoader = true; this.allProcessesList = []; From 6db78785e65f2bcf31892338ff19dd3ee22c3643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Sun, 21 Nov 2021 19:11:35 +0100 Subject: [PATCH 2/9] screen orientation changed from cordova to capacitor --- src/app/app.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 447d26c0d..692c31663 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -50,9 +50,9 @@ export class AppComponent { /* this.splashScreen.hide(); */ if (this.platform.is("tablet")) { - this.screenOrientation.unlock(); + window.screen.orientation.unlock(); } else if( this.platform.is("mobile")) { - this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT_PRIMARY); + window.screen.orientation.lock('portrait'); console.log('Orientation locked') } From 526b31cd029e3baf0dbea3c0b5735880eb23efc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Sun, 21 Nov 2021 19:49:59 +0100 Subject: [PATCH 3/9] camera bug fix no chat --- .../group-messages/group-messages.page.ts | 2 +- src/app/pages/chat/messages/messages.page.ts | 7 + src/app/services/functions/file.service.ts | 183 ++++++++++++++---- 3 files changed, 156 insertions(+), 36 deletions(-) diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index b89e7e8b1..8f51010bb 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -464,7 +464,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { //this.loadPicture(); } else if(res['data'] == 'add-picture'){ - this.fileService.addPictureToChat(this.roomId); + this.fileService.addPictureToChatMobile(this.roomId); //this.loadPicture(); } else if(res['data'] == 'add-document'){ diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 7d14e8fcd..e4f933f12 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -24,6 +24,8 @@ import { Filesystem, Directory, Encoding } from '@capacitor/filesystem'; import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder'; import { Haptics, ImpactStyle } from '@capacitor/haptics'; +const IMAGE_DIR = 'stored-images'; + @Component({ selector: 'app-messages', templateUrl: './messages.page.html', @@ -101,6 +103,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.loadFiles(); VoiceRecorder.requestAudioRecordingPermission(); + Filesystem.mkdir({ + path: IMAGE_DIR, + directory: Directory.Data, + recursive: true + }); } ngAfterViewInit() { diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts index 040f13324..843b12bb1 100644 --- a/src/app/services/functions/file.service.ts +++ b/src/app/services/functions/file.service.ts @@ -4,18 +4,29 @@ import { FileToBase64Service } from '../file/file-to-base64.service'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { ChatService } from '../chat.service'; -import { ModalController } from '@ionic/angular'; +import { ModalController, Platform,LoadingController } from '@ionic/angular'; import { SearchPage } from 'src/app/pages/search/search.page'; import { SearchList } from 'src/app/models/search-document'; import { ProcessesService } from '../processes.service'; import { ToastService } from '../toast.service'; import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera'; +import { Filesystem, Directory } from '@capacitor/filesystem'; + +const IMAGE_DIR = 'stored-images'; + +interface LocalFile { + name: string; + path: string; + data: string; +} + @Injectable({ providedIn: 'root' }) export class FileService { + images: LocalFile[] = []; capturedImage:any; capturedImageTitle:any; documents:SearchList[] = []; @@ -23,6 +34,7 @@ export class FileService { files: Set; photos: any[] = []; + idroom: any; constructor( private fileLoaderService: FileLoaderService, @@ -32,6 +44,8 @@ export class FileService { private modalController: ModalController, private processesService: ProcessesService, private toastService: ToastService, + private platform: Platform, + private loadingCtrl: LoadingController ) { } async takePicture() { @@ -93,59 +107,157 @@ export class FileService { }; } + //new method1 + async saveImage(photo: Photo, roomid: any) { + const base64Data = await this.readAsBase64(photo); + + const fileName = new Date().getTime() + '.jpeg'; + const savedFile = await Filesystem.writeFile({ + path: `${IMAGE_DIR}/${fileName}`, + data: base64Data, + directory: Directory.Data + }); + + this.loadFiles(roomid); + } + + //new method 2 + private async readAsBase64(photo: Photo) { + if (this.platform.is('hybrid')) { + const file = await Filesystem.readFile({ + path: photo.path + }); + + return file.data; + } + else { + // Fetch the photo, read as a blob, then convert to base64 format + const response = await fetch(photo.webPath); + const blob = await response.blob(); + + return await this.convertBlobToBase64(blob) as string; + } + } + + //new method 3 + async loadFiles(roomid) { + this.images = []; + + const loading = await this.loadingCtrl.create({ + message: 'Loading data...', + }); + await loading.present(); + + Filesystem.readdir({ + path: IMAGE_DIR, + directory: Directory.Data, + }).then(result => { + console.log('ALL RESULTS', result.files[0]) + let lastphoto = result.files[result.files.length - 1] + this.loadFileData(lastphoto,roomid); + }, + async (err) => { + console.log('ERROR FILE DOSENT EXIST', err) + // Folder does not yet exists! + await Filesystem.mkdir({ + path: IMAGE_DIR, + directory: Directory.Data, + recursive: true + }); + } + ).then(_ => { + loading.dismiss(); + }); + } + + //new method 4 + async loadFileData(fileName: string, roomid: any) { + console.log('ALL PHOTOT FILE', fileName) + // for (let f of fileNames) { + const filePath = `${IMAGE_DIR}/${fileName}`; + + const readFile = await Filesystem.readFile({ + path: filePath, + directory: Directory.Data, + }); + + this.images.push({ + name: fileName, + path: filePath, + data: `data:image/jpeg;base64,${readFile.data}`, + }); + + console.log('ALL IMAGE', this.images) + + this.capturedImage = this.images[0].data + + this.capturedImageTitle = new Date().getTime() + '.jpeg'; + + let body = { + "message": + { + "rid": roomid, + "msg": "", + "attachments": [{ + "title": this.capturedImageTitle, + "title_link_download": false, + "image_url": this.capturedImage, + }] + } + } + console.log('BODY TAKE PICTURE CHAT', body) + const loader = this.toastService.loading(); + this.chatService.sendMessage(body).subscribe(res=> { + console.log(res); + loader.remove(); + },(error) => { + loader.remove(); + this.toastService.badRequest("Não foi possível adicionar a fotografia!"); + }); + } + + + async addCameraPictureToChat(roomId){ - const capturedImage = await Camera.getPhoto({ - quality: 90, - // allowEditing: true, + const image = await Camera.getPhoto({ + quality: 50, + allowEditing: false, resultType: CameraResultType.Uri, - source: CameraSource.Camera - + source: CameraSource.Camera // Camera, Photos or Prompt! }); - const response = await fetch(capturedImage.webPath!); + + if (image) { + await this.saveImage(image,roomId) + } +/* const response = await fetch(capturedImage.webPath!); const blob = await response.blob(); this.photos.unshift({ filepath: "soon...", webviewPath: capturedImage.webPath - }); + }); */ - this.capturedImage = await this.convertBlobToBase64(blob); - this.capturedImageTitle = new Date().getTime() + '.jpeg'; - - let body = { - "message": - { - "rid": roomId, - "msg": "", - "attachments": [{ - "title": this.capturedImageTitle, - "title_link_download": false, - "image_url": this.capturedImage, - }] - } - } - const loader = this.toastService.loading(); - this.chatService.sendMessage(body).subscribe(res=> { - console.log(res); - loader.remove(); - },(error) => { - loader.remove(); - this.toastService.badRequest("Não foi possível adicionar a fotografia!"); - }); + //this.capturedImage = this.capturedImage; + + } async addPictureToChatMobile(roomId) { const capturedImage = await Camera.getPhoto({ - quality: 90, + quality: 50, // allowEditing: true, resultType: CameraResultType.Uri, source: CameraSource.Photos }); - const response = await fetch(capturedImage.webPath!); + + if (capturedImage) { + await this.saveImage(capturedImage,roomId) + } + /* const response = await fetch(capturedImage.webPath!); const blob = await response.blob(); this.photos.unshift({ @@ -177,7 +289,7 @@ export class FileService { },(error) => { //loader.remove(); }); - } + */ } addPictureToChat(roomId) { @@ -193,7 +305,7 @@ export class FileService { input.onchange = async () => { - alert('Onchange AQUI') + //alert('Onchange AQUI') const file = this.fileLoaderService.getFirstFile(input) @@ -218,6 +330,7 @@ export class FileService { } } + console.log('SELECT PICTURE GALLERY', body) console.log(this.capturedImage) this.chatService.sendMessage(body).subscribe(res=> { From 7121030ab141ca07b29fa53c7902cead9e11f23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Sun, 21 Nov 2021 19:50:37 +0100 Subject: [PATCH 4/9] camera fix on new publications --- .../pages/publications/new-publication/new-publication.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index f9ca5a972..4394b9a7a 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -382,7 +382,7 @@ export class NewPublicationPage implements OnInit { async selectImage() { const image = await Camera.getPhoto({ - quality: 90, + quality: 50, allowEditing: false, resultType: CameraResultType.Uri, source: CameraSource.Photos // Camera, Photos or Prompt! From 0130e4fac9b056461a5cb833fd1af32bfb395e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Sun, 21 Nov 2021 19:52:19 +0100 Subject: [PATCH 5/9] icon add --- firebase-messaging-sw.js | 34 ++++++++++++++++++++++++++-------- ios/App/App/config.xml | 4 ++++ ios/App/Podfile | 3 ++- package-lock.json | 10 ++++++++++ package.json | 2 ++ 5 files changed, 44 insertions(+), 9 deletions(-) diff --git a/firebase-messaging-sw.js b/firebase-messaging-sw.js index aa3917c40..138a7fd1c 100644 --- a/firebase-messaging-sw.js +++ b/firebase-messaging-sw.js @@ -1,11 +1,29 @@ - if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('./firebase-messaging-sw.js') - .then(function(registration) { - console.log('Registration successful, scope is:', registration.scope); - }).catch(function(err) { - console.log('Service worker registration failed, error:', err); - }); - } +if ("serviceWorker" in navigator) { + navigator.serviceWorker + .register("./firebase-messaging-sw.js") + .then(function(registration) { + console.log("Registration successful, scope is:", registration.scope); + messaging.getToken({vapidKey: 'BEuyzkUKcx4FSs-6GaIz_si2oV5Ut7e5ZEtcrVvr5L_tMVWZtS1NTqdtQkih5QCt2FZKuRUxZIaLm5GaxI6nJEw', serviceWorkerRegistration : registration }) + .then((currentToken) => { + if (currentToken) { + console.log('current token for client: ', currentToken); + + // Track the token -> client mapping, by sending to backend server + // show on the UI that permission is secured + } else { + console.log('No registration token available. Request permission to generate one.'); + + // shows on the UI that permission is required + } + }).catch((err) => { + console.log('An error occurred while retrieving token. ', err); + // catch error while creating client token + }); + }) + .catch(function(err) { + console.log("Service worker registration failed, error:" , err ); + }); + } // Scripts for firebase and firebase messaging diff --git a/ios/App/App/config.xml b/ios/App/App/config.xml index 43b503a74..b8563b6fc 100644 --- a/ios/App/App/config.xml +++ b/ios/App/App/config.xml @@ -6,6 +6,10 @@ + + + + diff --git a/ios/App/Podfile b/ios/App/Podfile index ee4cde511..6089bc9aa 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -10,11 +10,12 @@ def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app' + pod 'CapacitorBrowser', :path => '..\..\node_modules\@capacitor\browser' pod 'CapacitorCamera', :path => '..\..\node_modules\@capacitor\camera' + pod 'CapacitorFilesystem', :path => '..\..\node_modules\@capacitor\filesystem' pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics' pod 'CapacitorKeyboard', :path => '..\..\node_modules\@capacitor\keyboard' pod 'CapacitorNetwork', :path => '..\..\node_modules\@capacitor\network' - pod 'CapacitorFilesystem', :path => '..\..\node_modules\@capacitor\filesystem' pod 'CapacitorPushNotifications', :path => '..\..\node_modules\@capacitor\push-notifications' pod 'CapacitorVoiceRecorder', :path => '..\..\node_modules\capacitor-voice-recorder' pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' diff --git a/package-lock.json b/package-lock.json index ac401ff1e..d026f83f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2040,6 +2040,11 @@ "resolved": "https://registry.npmjs.org/@capacitor/app/-/app-1.0.5.tgz", "integrity": "sha512-U0dAw1CAjKyguSRxKDabszsQ4dj679RnxaUZrSHDR5Jnt5x308oQuKXFP++wnMBbw72D02iqjG0a+/Ujye7C9g==" }, + "@capacitor/browser": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@capacitor/browser/-/browser-1.0.6.tgz", + "integrity": "sha512-ZDx+HNPRQZKHpWxbYEyDz34Ge4fwhiiGg2UEnA+ol+pmdvHyYxw/c8HafCEVRJutHrXcVdSNoBNAeEPkQeabrQ==" + }, "@capacitor/camera": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@capacitor/camera/-/camera-1.2.0.tgz", @@ -7894,6 +7899,11 @@ "resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz", "integrity": "sha1-6GT2C//zQqHZJHeugvckmqYIXIA=" }, + "cordova-plugin-screen-orientation": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz", + "integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg==" + }, "cordova-plugin-splashscreen": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-5.0.4.tgz", diff --git a/package.json b/package.json index 517868044..874b58b5d 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@angular/router": "~12.1.2", "@capacitor/android": "3.3.1", "@capacitor/app": "^1.0.5", + "@capacitor/browser": "1.0.6", "@capacitor/camera": "^1.2.0", "@capacitor/core": "^3.3.0", "@capacitor/filesystem": "^1.0.6", @@ -93,6 +94,7 @@ "cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git", "cordova-plugin-filepath": "^1.5.8", "cordova-plugin-okhttp": "^2.0.0", + "cordova-plugin-screen-orientation": "^3.0.2", "cordova-res": "^0.15.3", "cordova-sqlite-storage": "^5.1.0", "cross-env": "^7.0.3", From 248b12cf87b7d65d80163a782b818ad4f69e0393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Mon, 22 Nov 2021 11:38:56 +0100 Subject: [PATCH 6/9] Bug fix on offline whene close the app the background color changed to default color --- src/app/app.component.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 692c31663..9e8e8372a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,6 +9,7 @@ import { NgxMatDateFormats } from '@angular-material-components/datetime-picker' const moment = _rollupMoment || _moment; import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { SqliteService } from 'src/app/services/sqlite.service'; +import { BackgroundService } from 'src/app/services/background.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; @@ -39,7 +40,8 @@ export class AppComponent { /* private splashScreen: SplashScreen, */ private statusBar: StatusBar, private screenOrientation: ScreenOrientation, - private sqliteservice: SqliteService + private sqliteservice: SqliteService, + private backgroundservice: BackgroundService ) { this.initializeApp(); } @@ -65,6 +67,18 @@ export class AppComponent { console.log("Error creating local database: ", error) } } + + window.addEventListener('online', () => { + console.log('Became online') + this.backgroundservice.online() + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + } else { + } + }); + window.addEventListener('offline', () => { + console.log('Became offline') + this.backgroundservice.offline() + }); }); } From 6dcc59980c0116ee04582f93d3d44cc985659ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Mon, 22 Nov 2021 11:43:13 +0100 Subject: [PATCH 7/9] Bug fix presenting photo when take picture is perform --- .../new-publication/new-publication.page.html | 2 +- .../new-publication/new-publication.page.ts | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app/pages/publications/new-publication/new-publication.page.html b/src/app/pages/publications/new-publication/new-publication.page.html index 86baacc96..7193e23c3 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.html +++ b/src/app/pages/publications/new-publication/new-publication.page.html @@ -29,7 +29,7 @@ - + diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 3a9cb5eff..6d8054c2b 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -404,7 +404,8 @@ export class NewPublicationPage implements OnInit { directory: Directory.Data }); - this.loadFiles(); + //this.loadFiles(fileName); + this.loadFileData(fileName); } private async readAsBase64(photo: Photo) { @@ -424,7 +425,7 @@ export class NewPublicationPage implements OnInit { } } - async loadFiles() { + async loadFiles(fileName) { this.images = []; const loading = await this.loadingCtrl.create({ @@ -432,11 +433,11 @@ export class NewPublicationPage implements OnInit { }); await loading.present(); - Filesystem.readdir({ - path: IMAGE_DIR, + /* Filesystem.readdir({ + path: `${IMAGE_DIR}/${fileName}`, directory: Directory.Data, }).then(result => { - console.log('ALL RESULTS', result.files[0]) + console.log('ALL RESULTS', result.files) let lastphoto = result.files[result.files.length - 1] this.loadFileData(lastphoto); }, @@ -451,12 +452,17 @@ export class NewPublicationPage implements OnInit { } ).then(_ => { loading.dismiss(); - }); + }); */ } async loadFileData(fileName: string) { console.log('ALL PHOTOT FILE', fileName) - // for (let f of fileNames) { + + const loading = await this.loadingCtrl.create({ + message: 'Loading data...', + }); + await loading.present(); + const filePath = `${IMAGE_DIR}/${fileName}`; const readFile = await Filesystem.readFile({ @@ -473,6 +479,8 @@ export class NewPublicationPage implements OnInit { console.log('ALL IMAGE', this.images) this.capturedImage = this.images[0].data - //} + + loading.dismiss(); + } } From b11b2bcb315f3d243d0150d822aa6c2c52904182 Mon Sep 17 00:00:00 2001 From: ivan gomes Date: Mon, 22 Nov 2021 13:53:37 +0100 Subject: [PATCH 8/9] imageWorkaround --- src/app/app-routing.module.ts | 4 ++ .../modals/group-icons/group-icons.page.html | 30 ++------- .../preview-camera/preview-camera.page.html | 11 ++-- .../preview-camera/preview-camera.page.scss | 31 ++++++++- .../preview-camera/preview-camera.page.ts | 7 +- .../video-allowed-routing.module.ts | 17 +++++ .../video-allowed/video-allowed.module.ts | 20 ++++++ .../video-allowed/video-allowed.page.html | 9 +++ .../video-allowed/video-allowed.page.scss | 0 .../video-allowed/video-allowed.page.spec.ts | 24 +++++++ .../video-allowed/video-allowed.page.ts | 25 ++++++++ .../pages/chat/messages/messages.page.html | 2 +- src/app/pages/chat/messages/messages.page.ts | 13 +++- .../new-publication/new-publication.page.html | 2 +- .../new-publication/new-publication.page.ts | 17 ++++- .../group-messages/group-messages.page.html | 2 +- .../group-messages/group-messages.page.ts | 62 +++++++++++++++++- .../shared/chat/messages/messages.page.html | 2 +- src/app/shared/chat/messages/messages.page.ts | 64 +++++++++++++++++-- src/global.scss | 2 +- 20 files changed, 294 insertions(+), 50 deletions(-) create mode 100644 src/app/modals/video-allowed/video-allowed-routing.module.ts create mode 100644 src/app/modals/video-allowed/video-allowed.module.ts create mode 100644 src/app/modals/video-allowed/video-allowed.page.html create mode 100644 src/app/modals/video-allowed/video-allowed.page.scss create mode 100644 src/app/modals/video-allowed/video-allowed.page.spec.ts create mode 100644 src/app/modals/video-allowed/video-allowed.page.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9db7c1c78..701c78b64 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -211,6 +211,10 @@ const routes = [ path: 'group-icons', loadChildren: () => import('./modals/group-icons/group-icons.module').then( m => m.GroupIconsPageModule) }, + { + path: 'video-allowed', + loadChildren: () => import('./modals/video-allowed/video-allowed.module').then( m => m.VideoAllowedPageModule) + }, diff --git a/src/app/modals/group-icons/group-icons.page.html b/src/app/modals/group-icons/group-icons.page.html index 63c1b2846..e92a1ac13 100644 --- a/src/app/modals/group-icons/group-icons.page.html +++ b/src/app/modals/group-icons/group-icons.page.html @@ -4,33 +4,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + Iniciar Video Chamada? + + Iniciar Video Chamada? + diff --git a/src/app/modals/preview-camera/preview-camera.page.html b/src/app/modals/preview-camera/preview-camera.page.html index 54bd15ae6..1bcfaa040 100644 --- a/src/app/modals/preview-camera/preview-camera.page.html +++ b/src/app/modals/preview-camera/preview-camera.page.html @@ -28,9 +28,10 @@ - + - + + @@ -41,15 +42,15 @@ - + - + - + diff --git a/src/app/modals/preview-camera/preview-camera.page.scss b/src/app/modals/preview-camera/preview-camera.page.scss index 00ca80045..20cee576f 100644 --- a/src/app/modals/preview-camera/preview-camera.page.scss +++ b/src/app/modals/preview-camera/preview-camera.page.scss @@ -8,8 +8,9 @@ ion-slides { .redla{ - color: rgb(255, 38, 0); - // background-color: rgb(255, 72, 0); + color: rgb(250, 248, 248); + background-color: rgb(255, 187, 0); + border-radius: 120px; } .cardconteudo { @@ -25,4 +26,28 @@ float: right; } .center{ clear: both; - } \ No newline at end of file + } + + + circle-xmark-solid{ + + // position: relative; + width: 512px; + height: 515px; + position: absolute; + left: 0%; + right: 0%; + top: 0%; + bottom: 0%; + + background: #FCD13A; + + + } + + + + + +/* Vector */ + diff --git a/src/app/modals/preview-camera/preview-camera.page.ts b/src/app/modals/preview-camera/preview-camera.page.ts index bfd05c403..477e5eda0 100644 --- a/src/app/modals/preview-camera/preview-camera.page.ts +++ b/src/app/modals/preview-camera/preview-camera.page.ts @@ -76,8 +76,11 @@ async getIconGallery(){ }); modal.present(); } + + openChat(){ + + + } } - - diff --git a/src/app/modals/video-allowed/video-allowed-routing.module.ts b/src/app/modals/video-allowed/video-allowed-routing.module.ts new file mode 100644 index 000000000..5c763b55c --- /dev/null +++ b/src/app/modals/video-allowed/video-allowed-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { VideoAllowedPage } from './video-allowed.page'; + +const routes: Routes = [ + { + path: '', + component: VideoAllowedPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class VideoAllowedPageRoutingModule {} diff --git a/src/app/modals/video-allowed/video-allowed.module.ts b/src/app/modals/video-allowed/video-allowed.module.ts new file mode 100644 index 000000000..0c2dc882b --- /dev/null +++ b/src/app/modals/video-allowed/video-allowed.module.ts @@ -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 { VideoAllowedPageRoutingModule } from './video-allowed-routing.module'; + +import { VideoAllowedPage } from './video-allowed.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + VideoAllowedPageRoutingModule + ], + declarations: [VideoAllowedPage] +}) +export class VideoAllowedPageModule {} diff --git a/src/app/modals/video-allowed/video-allowed.page.html b/src/app/modals/video-allowed/video-allowed.page.html new file mode 100644 index 000000000..df2ffe66f --- /dev/null +++ b/src/app/modals/video-allowed/video-allowed.page.html @@ -0,0 +1,9 @@ + + + videoAllowed + + + + + + diff --git a/src/app/modals/video-allowed/video-allowed.page.scss b/src/app/modals/video-allowed/video-allowed.page.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/modals/video-allowed/video-allowed.page.spec.ts b/src/app/modals/video-allowed/video-allowed.page.spec.ts new file mode 100644 index 000000000..d41be6fd1 --- /dev/null +++ b/src/app/modals/video-allowed/video-allowed.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { VideoAllowedPage } from './video-allowed.page'; + +describe('VideoAllowedPage', () => { + let component: VideoAllowedPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ VideoAllowedPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(VideoAllowedPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modals/video-allowed/video-allowed.page.ts b/src/app/modals/video-allowed/video-allowed.page.ts new file mode 100644 index 000000000..b1d545bc7 --- /dev/null +++ b/src/app/modals/video-allowed/video-allowed.page.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-video-allowed', + templateUrl: './video-allowed.page.html', + styleUrls: ['./video-allowed.page.scss'], +}) +export class VideoAllowedPage implements OnInit { + modalController: any; + + constructor() { } + + ngOnInit() { + } + + dismiss() { + // using the injected ModalController this page + // can "dismiss" itself and optionally pass back data + this.modalController.dismiss({ + 'dismissed': true + }); + } +} + + diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index 99a543a95..cf14f59d9 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -60,7 +60,7 @@ {{msg.msg}}
- image + image
diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 3e3124daa..b1f719324 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -642,11 +642,22 @@ touchStart(card) { componentProps: { image: msg.attachments[0].image_url, username: msg.u.username, - _updatedAt: msg._updatedAt + _updatedAt: msg._updatedAt, } + + }); modal.present(); } + + imageSize(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); +} } diff --git a/src/app/pages/publications/new-publication/new-publication.page.html b/src/app/pages/publications/new-publication/new-publication.page.html index 86baacc96..1d61c1731 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.html +++ b/src/app/pages/publications/new-publication/new-publication.page.html @@ -29,7 +29,7 @@ - + diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 3a9cb5eff..8721ef716 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -116,6 +116,15 @@ export class NewPublicationPage implements OnInit { } + imageSize(image){ + var canvas = document.createElement('canvas'); + var ctx = canvas.getContext('2d'); + canvas.width=300 + canvas.height=234 + ctx.drawImage(image, 0, 0, 300, 234); + document.body.appendChild(canvas); + } + convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => { const reader = new FileReader; reader.onerror = reject; @@ -379,7 +388,6 @@ export class NewPublicationPage implements OnInit { - async selectImage() { const image = await Camera.getPhoto({ quality: 50, @@ -393,6 +401,8 @@ export class NewPublicationPage implements OnInit { } } + + // Create a new file from a capture image async saveImage(photo: Photo) { const base64Data = await this.readAsBase64(photo); @@ -475,4 +485,9 @@ export class NewPublicationPage implements OnInit { this.capturedImage = this.images[0].data //} } + + + + + } diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html index e8ba47bdc..0ebc7fdbb 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -44,7 +44,7 @@ A conversa original mantêm-se como chat individual
-
+
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 9e57e30e8..aed1437d7 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -1,5 +1,5 @@ -import { Component, OnChanges, OnInit, Input, SimpleChanges, Output, EventEmitter, ViewChild, ElementRef, AfterViewChecked, AfterViewInit, OnDestroy} from '@angular/core'; -import { ActionSheetController, AnimationController, MenuController, ModalController, PopoverController } from '@ionic/angular'; +import { Component, OnChanges, OnInit, Input, SimpleChanges,ChangeDetectorRef,Output, EventEmitter, ViewChild, ElementRef, AfterViewChecked, AfterViewInit, OnDestroy} from '@angular/core'; +import { ActionSheetController, AnimationController, IonSlides, MenuController, ModalController, PopoverController } from '@ionic/angular'; import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; @@ -19,6 +19,7 @@ import { ProcessesService } from 'src/app/services/processes.service'; import { FileService } from 'src/app/services/functions/file.service'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ThemeService } from 'src/app/services/theme.service' +import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page'; /* import * as pdfjsLib from 'pdfjs-dist'; @@ -86,7 +87,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe private fileToBase64Service: FileToBase64Service, private processesService: ProcessesService, private fileService: FileService, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private changeDetectorRef: ChangeDetectorRef ) { this.loggedUserChat = authService.ValidatedUserChat['data']; this.isGroupCreated = true; @@ -767,7 +769,61 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } } + + sliderOpts = { + zoom: false, + slidesPerView: 1.5, + spaceBetween: 20, + centeredSlides: true + }; + zoomActive = false; +zoomScale = 1; + +sliderZoomOpts = { + allowSlidePrev: false, + allowSlideNext: false, + zoom: { + maxRatio: 5 + }, + on: { + zoomChange: (scale, imageEl, slideEl) => { + this.zoomActive = true; + this.zoomScale = scale/5; + this.changeDetectorRef.detectChanges(); + } + } +} + +async touchEnd(zoomslides: IonSlides, card) { + // Zoom back to normal + const slider = await zoomslides.getSwiper(); + const zoom = slider.zoom; + zoom.out(); + + // Card back to normal + card.el.style['z-index'] = 9; + + this.zoomActive = false; + this.changeDetectorRef.detectChanges(); +} + +touchStart(card) { + // Make card appear above backdrop + card.el.style['z-index'] = 11; +} + async openPreview(img) { + const modal = await this.modalController.create({ + component: PreviewCameraPage, + cssClass: 'transparent-modal', + componentProps: { + image: img.attachments[0].image_url, + username: img.u.username, + _updatedAt: img._updatedAt + } + }); + modal.present(); + } } diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 53f592363..8f1fe149b 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -37,7 +37,7 @@
-
+
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 8f11f9533..b3eec13c2 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -1,5 +1,5 @@ -import { AfterViewChecked, AfterViewInit, Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; -import { AnimationController, GestureController, ModalController, PopoverController } from '@ionic/angular'; +import { AfterViewChecked, AfterViewInit, Component, ElementRef,ChangeDetectorRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; +import { AnimationController, GestureController, IonSlides, ModalController, PopoverController } from '@ionic/angular'; import { AlertService } from 'src/app/services/alert.service'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; @@ -16,6 +16,7 @@ import { FileService } from 'src/app/services/functions/file.service'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ThemeService } from 'src/app/services/theme.service' +import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page'; @Component({ selector: 'app-messages', @@ -71,7 +72,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy private fileService: FileService, private gestureController: GestureController, private http:HttpClient, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private changeDetectorRef: ChangeDetectorRef ) { this.loggedUser = authService.ValidatedUserChat['data']; @@ -553,7 +555,61 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.serverLongPull(); }); + }sliderOpts = { + zoom: false, + slidesPerView: 1.5, + spaceBetween: 20, + centeredSlides: true + }; + zoomActive = false; +zoomScale = 1; + +sliderZoomOpts = { + allowSlidePrev: false, + allowSlideNext: false, + zoom: { + maxRatio: 5 + }, + on: { + zoomChange: (scale, imageEl, slideEl) => { + this.zoomActive = true; + this.zoomScale = scale/5; + this.changeDetectorRef.detectChanges(); + } } - +} + +async touchEnd(zoomslides: IonSlides, card) { + // Zoom back to normal + const slider = await zoomslides.getSwiper(); + const zoom = slider.zoom; + zoom.out(); + + // Card back to normal + card.el.style['z-index'] = 9; + + this.zoomActive = false; + this.changeDetectorRef.detectChanges(); +} + +touchStart(card) { + // Make card appear above backdrop + card.el.style['z-index'] = 11; } + async openPreview(msg) { + const modal = await this.modalController.create({ + component: PreviewCameraPage, + cssClass: 'transparent-modal', + componentProps: { + image: msg.attachments[0].image_url, + username: msg.u.username, + _updatedAt: msg._updatedAt + } + }); + modal.present(); + } +} + + + diff --git a/src/global.scss b/src/global.scss index 23b37489d..b12d9d99f 100644 --- a/src/global.scss +++ b/src/global.scss @@ -1339,7 +1339,7 @@ ngx-mat-datetime-content{ --background: #0000005c; ion-content { - --background:transparent; + --background:#2e2121e7; } } From 674f3636b36bcdb7434564a0ad308597b05a4fbf Mon Sep 17 00:00:00 2001 From: ivan gomes Date: Mon, 22 Nov 2021 15:26:04 +0100 Subject: [PATCH 9/9] Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into developer --- .../CordovaPlugins.podspec | 18 -------------- .../CordovaPluginsStatic.podspec | 16 ------------- package-lock.json | 20 ++++++++++++++++ package.json | 2 ++ src/app/app.component.ts | 16 ++++++++++++- src/app/pages/chat/chat.page.ts | 10 +++++++- .../new-publication/new-publication.page.ts | 24 ++++++++++++------- .../pages/publications/publications.page.ts | 14 ++++++++++- src/global.scss | 3 +++ 9 files changed, 78 insertions(+), 45 deletions(-) delete mode 100644 ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec delete mode 100644 ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec diff --git a/ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec b/ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec deleted file mode 100644 index 79b4ae24e..000000000 --- a/ios/capacitor-cordova-ios-plugins/CordovaPlugins.podspec +++ /dev/null @@ -1,18 +0,0 @@ - - Pod::Spec.new do |s| - s.name = 'CordovaPlugins' - s.version = '3.3.0' - s.summary = 'Autogenerated spec' - s.license = 'Unknown' - s.homepage = 'https://example.com' - s.authors = { 'Capacitor Generator' => 'hi@example.com' } - s.source = { :git => 'https://github.com/ionic-team/does-not-exist.git', :tag => '3.3.0' } - s.source_files = 'sources/**/*.{swift,h,m,c,cc,mm,cpp}' - s.ios.deployment_target = '12.0' - s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1 WK_WEB_VIEW_ONLY=1' } - s.dependency 'CapacitorCordova' - s.swift_version = '5.1' - s.weak_frameworks = 'AudioToolbox', 'SystemConfiguration' - s.frameworks = 'AssetsLibrary', 'MobileCoreServices', 'CoreGraphics', 'CoreTelephony' - s.compiler_flags = '-w -w -DSQLITE_THREADSAFE=1 -DSQLITE_DEFAULT_SYNCHRONOUS=3 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_TEMP_STORE=2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_RTREE -DSQLITE_DEFAULT_PAGE_SIZE=4096' - end \ No newline at end of file diff --git a/ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec b/ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec deleted file mode 100644 index 424541041..000000000 --- a/ios/capacitor-cordova-ios-plugins/CordovaPluginsStatic.podspec +++ /dev/null @@ -1,16 +0,0 @@ - - Pod::Spec.new do |s| - s.name = 'CordovaPluginsStatic' - s.version = '3.3.0' - s.summary = 'Autogenerated spec' - s.license = 'Unknown' - s.homepage = 'https://example.com' - s.authors = { 'Capacitor Generator' => 'hi@example.com' } - s.source = { :git => 'https://github.com/ionic-team/does-not-exist.git', :tag => '3.3.0' } - s.source_files = 'sourcesstatic/**/*.{swift,h,m,c,cc,mm,cpp}' - s.ios.deployment_target = '12.0' - s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1 WK_WEB_VIEW_ONLY=1' } - s.dependency 'CapacitorCordova' - s.swift_version = '5.1' - s.static_framework = true - end \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d8f24c38a..878a7078f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2958,6 +2958,21 @@ "@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", @@ -7842,6 +7857,11 @@ "integrity": "sha1-C8ZXVyduvZIMASzpIOJ0F3V2Nz4=", "dev": true }, + "cordova-plugin-crop": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-crop/-/cordova-plugin-crop-0.4.0.tgz", + "integrity": "sha1-TZ6Jgsz7OOBPqQnIe0vsBuLR2Ss=" + }, "cordova-plugin-dbcopy": { "version": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git#861f585e4313db828d6b8c7d354c32c83373d0d2", "from": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git" diff --git a/package.json b/package.json index 6bc660e48..8affa6bb6 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "@fullcalendar/interaction": "^5.3.0", "@ionic-native/camera": "^5.31.1", "@ionic-native/core": "^5.0.7", + "@ionic-native/crop": "^5.36.0", "@ionic-native/fcm": "^5.36.0", "@ionic-native/file": "^5.36.0", "@ionic-native/file-path": "^5.30.0", @@ -93,6 +94,7 @@ "capacitor-voice-recorder": "^2.0.0", "ci": "^2.1.1", "cordova": "^10.0.0", + "cordova-plugin-crop": "^0.4.0", "cordova-plugin-dbcopy": "git+https://github.com/an-rahulpandey/cordova-plugin-dbcopy.git", "cordova-plugin-filepath": "^1.5.8", "cordova-plugin-okhttp": "^2.0.0", diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 692c31663..9e8e8372a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,6 +9,7 @@ import { NgxMatDateFormats } from '@angular-material-components/datetime-picker' const moment = _rollupMoment || _moment; import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { SqliteService } from 'src/app/services/sqlite.service'; +import { BackgroundService } from 'src/app/services/background.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; @@ -39,7 +40,8 @@ export class AppComponent { /* private splashScreen: SplashScreen, */ private statusBar: StatusBar, private screenOrientation: ScreenOrientation, - private sqliteservice: SqliteService + private sqliteservice: SqliteService, + private backgroundservice: BackgroundService ) { this.initializeApp(); } @@ -65,6 +67,18 @@ export class AppComponent { console.log("Error creating local database: ", error) } } + + window.addEventListener('online', () => { + console.log('Became online') + this.backgroundservice.online() + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + } else { + } + }); + window.addEventListener('offline', () => { + console.log('Became offline') + this.backgroundservice.offline() + }); }); } diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 9056c7ef8..c864de07c 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -30,6 +30,7 @@ import { environment } from 'src/environments/environment'; import { TimeService } from 'src/app/services/functions/time.service'; import { ThemeService } from 'src/app/services/theme.service' import { DataService } from 'src/app/services/data.service'; +import { Crop } from '@ionic-native/crop/ngx'; @Component({ @@ -119,6 +120,7 @@ export class ChatPage implements OnInit { public ThemeService: ThemeService, private dataService:DataService, private router: Router, + private crop: Crop, ){ this.loggedUserChat = authService.ValidatedUserChat['data']; this.headers = new HttpHeaders(); @@ -549,4 +551,10 @@ hideRefreshButton(){ modal.onDidDismiss(); } -} +// this.crop.crop('path/to/image.jpg', {quality: 75}) +// .then( +// newImage => console.log('new image path is: ' + newImage), +// error => console.error('Error cropping image', error) +// ); + + } diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 8721ef716..4a347baf5 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -414,7 +414,8 @@ export class NewPublicationPage implements OnInit { directory: Directory.Data }); - this.loadFiles(); + //this.loadFiles(fileName); + this.loadFileData(fileName); } private async readAsBase64(photo: Photo) { @@ -434,7 +435,7 @@ export class NewPublicationPage implements OnInit { } } - async loadFiles() { + async loadFiles(fileName) { this.images = []; const loading = await this.loadingCtrl.create({ @@ -442,11 +443,11 @@ export class NewPublicationPage implements OnInit { }); await loading.present(); - Filesystem.readdir({ - path: IMAGE_DIR, + /* Filesystem.readdir({ + path: `${IMAGE_DIR}/${fileName}`, directory: Directory.Data, }).then(result => { - console.log('ALL RESULTS', result.files[0]) + console.log('ALL RESULTS', result.files) let lastphoto = result.files[result.files.length - 1] this.loadFileData(lastphoto); }, @@ -461,12 +462,17 @@ export class NewPublicationPage implements OnInit { } ).then(_ => { loading.dismiss(); - }); + }); */ } async loadFileData(fileName: string) { console.log('ALL PHOTOT FILE', fileName) - // for (let f of fileNames) { + + const loading = await this.loadingCtrl.create({ + message: 'Loading data...', + }); + await loading.present(); + const filePath = `${IMAGE_DIR}/${fileName}`; const readFile = await Filesystem.readFile({ @@ -483,7 +489,9 @@ export class NewPublicationPage implements OnInit { console.log('ALL IMAGE', this.images) this.capturedImage = this.images[0].data - //} + + loading.dismiss(); + } diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index c0e2309f1..1916b987a 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -16,6 +16,7 @@ import { PublicationTravelFolderStore } from 'src/app/store/publication-travel-f import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' +import { Crop } from '@ionic-native/crop/ngx'; @Component({ selector: 'app-publications', @@ -68,7 +69,8 @@ export class PublicationsPage implements OnInit { private sqliteservice: SqliteService, private backgroundservice: BackgroundService, private platform: Platform, - public ThemeService: ThemeService + public ThemeService: ThemeService, + private crop: Crop, ) { this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"]; this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"]; @@ -91,6 +93,8 @@ export class PublicationsPage implements OnInit { } + + hideRefreshButton() { window.onresize = (event) => { if (window.innerWidth < 801) { @@ -452,4 +456,12 @@ export class PublicationsPage implements OnInit { }); } + // this.crop.crop('path/to/image.jpg', {quality: 75}) + // .then( + // newImage => console.log('new image path is: ' + newImage), + // error => console.error('Error cropping image', error) + // ); + + + } diff --git a/src/global.scss b/src/global.scss index b12d9d99f..e59d967e6 100644 --- a/src/global.scss +++ b/src/global.scss @@ -1355,4 +1355,7 @@ ngx-mat-datetime-content{ --background:transparent; } + .transparent-modal .modal-wrapper { + --background: rgba(44, 39, 45, 0.7); + } } \ No newline at end of file