Profile picture, notifications, chat romms

This commit is contained in:
Eudes Inácio
2023-09-18 05:41:33 +01:00
parent 540750e0e9
commit 527cc0f2a6
10 changed files with 236 additions and 124 deletions
@@ -39,8 +39,8 @@ export class EditProfilePage implements OnInit {
) { }
ngOnInit() {
this.getProfilpictureFromStorage();
this.getProfilpictureFromStorage();
}
getProfilpictureFromStorage() {
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
@@ -50,27 +50,27 @@ export class EditProfilePage implements OnInit {
this.profilePicture = "";
})
}
/* getProfilpicture(guid) {
console.log('Get picture ', guid.path)
this.attachmentService.getUserProfilePhoto().subscribe(async (picture: any) => {
console.log('Get picture ', picture)
this.storageService.store(this.SessionStore.user.RoleID.toString() + "guid", guid.path)
this.storageService.store(this.SessionStore.user.RoleID.toString(), picture).then((value) => {
this.profilePicture = picture
this.SessionStore.user.UserPhoto = picture;
console.log('picture saved')
}).catch((error) => {
console.log('picture not saved')
});
}, ((error) => {
console.log('Error get profile picture: ', error)
}))
} */
/* getProfilpicture(guid) {
console.log('Get picture ', guid.path)
this.attachmentService.getUserProfilePhoto().subscribe(async (picture: any) => {
console.log('Get picture ', picture)
this.storageService.store(this.SessionStore.user.RoleID.toString() + "guid", guid.path)
this.storageService.store(this.SessionStore.user.RoleID.toString(), picture).then((value) => {
this.profilePicture = picture
this.SessionStore.user.UserPhoto = picture;
console.log('picture saved')
}).catch((error) => {
console.log('picture not saved')
});
}, ((error) => {
console.log('Error get profile picture: ', error)
}))
} */
close() {
this.modalController.dismiss();
@@ -188,14 +188,23 @@ export class EditProfilePage implements OnInit {
this.attachmentService.addUserProfilePhoto(object).subscribe((guid) => {
console.log('GUID ', guid)
console.log(this.SessionStore.user.RoleID.toString())
this.storageService.store(this.SessionStore.user.RoleID.toString(), this.capturedImage).then((value) => {
this.profilePicture = 'data:image/jpeg;base64,' +this.capturedImage;
//get user profile picture base64
this.attachmentService.getUserProfilePhoto(guid).subscribe((base) => {
console.log('before picture saved',base)
this.storageService.store(this.SessionStore.user.RoleID.toString(), 'data:image/jpeg;base64,'+base).then((value) => {
this.profilePicture = 'data:image/jpeg;base64,' + base;
console.log('picture saved')
}).catch((error) => {
console.log('picture not saved')
});
console.log('picture saved',value)
}).catch((error) => {
console.log('picture not saved')
});
},(error) => {
console.log('profile picture erro: ', error)
})
/* this.getProfilpicture(guid); */
}, ((error) => {
console.log('Erro Upload profile picture ', error)