diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.ts b/src/app/modals/profile/edit-profile/edit-profile.page.ts index bc4aeaaf4..59025bafe 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.ts +++ b/src/app/modals/profile/edit-profile/edit-profile.page.ts @@ -45,7 +45,7 @@ export class EditProfilePage implements OnInit { private httpErrorHandle: HttpErrorHandle, private UserRepositoryService: UserRepositoryService - ) { + ) { this.profilePictureSubject = this.UserRepositoryService.getProfilePictureLive() as any } @@ -165,7 +165,7 @@ export class EditProfilePage implements OnInit { } CameraSource = CameraSource - @XTracerAsync({name:'edit-profile/takePicture', bugPrint: true, autoFinish: false}) + @XTracerAsync({name:'edit-profile/takePicture', bugPrint: true}) async uploadPicture(source: CameraSource, tracing?: TracingType) { const capturedImage = await this.CameraService.takePicture({ @@ -186,7 +186,7 @@ export class EditProfilePage implements OnInit { const guid = await this.UserRepositoryService.addUserProfilePhoto(object) - + if(guid.isOk()) { tracing.addEvent('upload image') @@ -194,23 +194,16 @@ export class EditProfilePage implements OnInit { if(base.isOk()) { tracing.addEvent('download image') - this.storageService.store(this.SessionStore.user.RoleID.toString(), 'data:image/jpeg;base64,'+base.value).then((value) => { - tracing.addEvent('store image in') - this.profilePicture = 'data:image/jpeg;base64,' + base.value; - - tracing.setAttribute("picture.save", "true") - tracing.finish() - }).catch((error) => { - tracing.setAttribute("picture.save", "false") - tracing.finish() - }); + this.profilePicture = 'data:image/jpeg;base64,' + base.value; + + tracing.setAttribute("picture.save", "true") + } else { if(!isHttpError(base.error)) { this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.') } else { this.httpErrorHandle.httpStatusHandle(base.error) } - tracing.finish() } } else { @@ -219,9 +212,8 @@ export class EditProfilePage implements OnInit { } else { this.httpErrorHandle.httpStatusHandle(guid.error) } - tracing.finish() } - + } } diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index eade07387..fa20bd9bb 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -21,6 +21,8 @@ import { NotificationRepositoryService } from 'src/app/module/notification/data/ import { Observable } from 'rxjs'; import { UserRepositoryService } from 'src/app/module/user/data/user-repository.service'; import { UserProfilePicture } from 'src/app/module/user/data/datasource/user-local-repository.service'; +import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer'; +import { isHttpError } from 'src/app/services/http.service'; @Component({ selector: 'app-header', @@ -128,30 +130,27 @@ export class HeaderPage implements OnInit { } - getProfilpicture() { + @XTracerAsync({name:'header/getPrfilePicture', bugPrint: true}) + async getProfilpicture(tracing?: TracingType) { if (this.SessionStore.user.UserPhoto) { - this.attachmentService.getUserProfilePhoto(this.SessionStore.user.UserPhoto).subscribe((base) => { - this.storageService.store(this.SessionStore.user.RoleID.toString(), 'data:image/jpeg;base64,' + base).then((value) => { - this.profilePicture = 'data:image/jpeg;base64,' + base; + const base = await this.UserRepositoryService.getUserProfilePhoto(this.SessionStore.user.UserPhoto, tracing) - console.log('picture saved') - }).catch((error) => { - console.log('picture not saved') - }); - }, (error) => { - console.log('profile picture errro: ', error) - this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => { - /* console.log(picture) */ - this.profilePicture = picture - }).catch((error) => { - this.profilePicture = ""; - }) - }) + if(base.isOk()) { + tracing.addEvent('download image') + this.profilePicture = 'data:image/jpeg;base64,' + base.value; + + tracing.setAttribute("picture.save", "true") + + } else { + if(!isHttpError(base.error)) { + // this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.') + } else { + // this.httpErrorHandle.httpStatusHandle(base.error) + } + } - } else { - this.profilePicture = ""; } } diff --git a/version/git-version.ts b/version/git-version.ts index 87ad00918..b91fd0bd0 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,11 +1,11 @@ export let versionData = { - "shortSHA": "46bb078dd", - "SHA": "46bb078dd23b769b99b7b82c89b41a7236b20f7b", + "shortSHA": "20c50318b", + "SHA": "20c50318b2e37d32914e000f323cc5c783efb9e5", "branch": "feature/agenda-api-peter", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Wed Jul 24 13:37:02 2024 +0100'", - "lastCommitMessage": "improve profile reactiveness and action page performance", - "lastCommitNumber": "5878", - "changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 2 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: version/git-version.ts", + "lastCommitTime": "'Wed Jul 24 13:42:03 2024 +0100'", + "lastCommitMessage": "update giver sion", + "lastCommitNumber": "5879", + "changeStatus": "On branch feature/agenda-api-peter\nYour branch is up to date with 'origin/feature/agenda-api-peter'.\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.ts\n\tmodified: src/app/shared/header/header.page.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file