mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
profile picture click added
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="d-flex align-center flex-column">
|
||||
<div class="d-flex align-center flex-column" (click)="takePicture()">
|
||||
|
||||
<ion-icon *ngIf="SessionStore.user.RoleDescription != 'Presidente da República' && SessionStore.user.RoleDescription != 'Ministro e Director do Gabinete do PR' && SessionStore.user.RoleDescription != 'Secretário Geral' " class="profile-pic"
|
||||
src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AnimationController, ModalController,Platform } from '@ionic/angular';
|
||||
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
||||
import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page';
|
||||
import { PinPage } from 'src/app/shared/pin/pin.page';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { BackgroundService } from 'src/app/services/background.service';
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-profile',
|
||||
@@ -17,15 +21,18 @@ export class EditProfilePage implements OnInit {
|
||||
SessionStore = SessionStore
|
||||
production = environment.production
|
||||
environment = environment
|
||||
capturedImage = '';
|
||||
capturedImageTitle = '';
|
||||
|
||||
constructor(private modalController:ModalController,
|
||||
constructor(private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
public platform: Platform,
|
||||
private BackgroundService: BackgroundService,
|
||||
public ThemeService: ThemeService
|
||||
) {}
|
||||
public ThemeService: ThemeService,
|
||||
private file: File,
|
||||
) { }
|
||||
|
||||
ngOnInit() {}
|
||||
ngOnInit() { }
|
||||
|
||||
close() {
|
||||
this.modalController.dismiss();
|
||||
@@ -122,5 +129,72 @@ export class EditProfilePage implements OnInit {
|
||||
this.BackgroundService.paint();
|
||||
}
|
||||
|
||||
|
||||
async takePicture() {
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 50,
|
||||
// allowEditing: true,
|
||||
resultType: CameraResultType.Base64,
|
||||
source: CameraSource.Camera
|
||||
});
|
||||
|
||||
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
|
||||
this.capturedImageTitle = SessionStore.user.Profile;
|
||||
this.saveFile(this.capturedImage,this.capturedImageTitle,'application/img');
|
||||
|
||||
}
|
||||
|
||||
async saveFile(pdfString, filename, type) {
|
||||
const blob = this.b64toBlob(pdfString, type)
|
||||
console.log(blob)
|
||||
let pathFile = ''
|
||||
const fileName = filename
|
||||
const contentFile = blob
|
||||
if (this.platform.is('ios')) {
|
||||
pathFile = this.file.documentsDirectory
|
||||
} else {
|
||||
pathFile = this.file.externalRootDirectory
|
||||
}
|
||||
|
||||
console.log(pathFile)
|
||||
|
||||
await Filesystem.writeFile({
|
||||
path: fileName,
|
||||
data: pdfString,
|
||||
directory: Directory.Documents,
|
||||
}).then((dir) => {
|
||||
console.log('DIR ', dir)
|
||||
});
|
||||
}
|
||||
|
||||
getImagem() {
|
||||
|
||||
}
|
||||
|
||||
b64toBlob(b64Data, contentType) {
|
||||
contentType = contentType || '';
|
||||
var sliceSize = 512;
|
||||
b64Data = b64Data.replace(/^[^,]+,/, '');
|
||||
b64Data = b64Data.replace(/\s/g, '');
|
||||
var byteCharacters = window.atob(b64Data);
|
||||
var byteArrays = [];
|
||||
|
||||
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
||||
var slice = byteCharacters.slice(offset, offset + sliceSize);
|
||||
|
||||
var byteNumbers = new Array(slice.length);
|
||||
for (var i = 0; i < slice.length; i++) {
|
||||
byteNumbers[i] = slice.charCodeAt(i);
|
||||
}
|
||||
|
||||
var byteArray = new Uint8Array(byteNumbers);
|
||||
|
||||
byteArrays.push(byteArray);
|
||||
}
|
||||
|
||||
var blob = new Blob(byteArrays, { type: contentType });
|
||||
return blob;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
export let versionData = {
|
||||
"shortSHA": "fe6614a37",
|
||||
"SHA": "fe6614a37e7a183df5a93894ced3f8adefc12bbe",
|
||||
"shortSHA": "8525fcb8f",
|
||||
"SHA": "8525fcb8f6be35b1ef298bf82482c8179de1fe1b",
|
||||
"branch": "developer-prod",
|
||||
"lastCommitAuthor": "'Eudes Inácio'",
|
||||
"lastCommitTime": "'Mon Aug 28 11:32:19 2023 +0100'",
|
||||
"lastCommitMessage": "merge with developer-prod-2",
|
||||
"lastCommitNumber": "5219",
|
||||
"lastCommitTime": "'Mon Aug 28 16:36:31 2023 +0100'",
|
||||
"lastCommitMessage": "compress image of publications and chat",
|
||||
"lastCommitNumber": "5220",
|
||||
"change": "",
|
||||
"changeStatus": "On branch developer-prod\nYour branch is ahead of 'origin/developer-prod' by 12 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/pages/chat/messages/messages.page.ts\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/shared/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/shared/chat/messages/messages.page.ts\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts",
|
||||
"changeStatus": "On branch developer-prod\nYour branch is ahead of 'origin/developer-prod' by 13 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.html\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.ts",
|
||||
"changeAuthor": "eudes.inacio"
|
||||
}
|
||||
Reference in New Issue
Block a user