mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
improve the way wa getting the user profile picture
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user