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 1/2] 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 2/2] 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(); + } }