mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -11,6 +11,7 @@ import { AlertController } from '@ionic/angular';
|
||||
import { LocalstoreService } from '../store/localstore.service';
|
||||
import { ToastService } from './toast.service';
|
||||
import { UserStore } from 'src/app/store/user.service'
|
||||
import { SHA1, SHA256, AES, enc } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -48,18 +49,16 @@ export class AuthService {
|
||||
|
||||
|
||||
async login(user: UserForm): Promise<boolean> {
|
||||
//user.BasicAuthKey = 'Basic ' + btoa(user.username + '@' + user.domainName + ':' + user.password);
|
||||
// user.BasicAuthKey = 'Basic ' + btoa(user.username + '@' + user.domainName + ':' + user.password);
|
||||
user.BasicAuthKey = 'Basic ' + btoa(user.username + ':' + user.password); //conversão em base64 das credenciais inseridas
|
||||
console.log('Basic ' + btoa(user.username + ':' + SHA1(user.password).toString())); //conversão em base64 das credenciais inseridas
|
||||
|
||||
|
||||
const options = { headers: {'Authorization': user.BasicAuthKey }};
|
||||
this.headers = this.headers.set('Authorization',user.BasicAuthKey);
|
||||
this.opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
const service = environment.apiURL + "userauthentication/GetValidateAuth";
|
||||
|
||||
let result: boolean | PromiseLike<boolean> = false;
|
||||
let response: any;
|
||||
|
||||
try {
|
||||
@@ -76,7 +75,7 @@ export class AuthService {
|
||||
response.BasicAuthKey = user.BasicAuthKey
|
||||
this.ValidatedUser = response;
|
||||
|
||||
console.log('response', response)
|
||||
// console.log('response', response)
|
||||
|
||||
this.localstoreService.set('user', response)
|
||||
this.userStore.reset(response)
|
||||
|
||||
@@ -195,7 +195,7 @@ export class NotificationsService {
|
||||
var notificationReceived = (message) => {
|
||||
//this.jsonstore.createCollection('Notifications',message);
|
||||
this.DataArray.push(message)
|
||||
console.log("On ReceiveNotification", message)
|
||||
console.log("On ReceiveNotification", this.DataArray)
|
||||
this.storageService.store("Notifications",JSON.stringify(this.DataArray))
|
||||
|
||||
console.log(message);
|
||||
|
||||
@@ -175,7 +175,7 @@ export class ProcessesService {
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
|
||||
UpdateTaskStatus(FolderId:string): Observable<any>{
|
||||
UpdateTaskStatus(FolderId:any): Observable<any>{
|
||||
const geturl = environment.apiURL + 'Tasks/UpdateTaskStatus';
|
||||
let params = new HttpParams();
|
||||
|
||||
|
||||
@@ -23,10 +23,24 @@ export class SynchroService {
|
||||
private id: string = uuidv4();
|
||||
public conected = false
|
||||
private url: string = ''
|
||||
callback = function(){}
|
||||
|
||||
constructor(){}
|
||||
|
||||
setUrl(wss:wss) {
|
||||
setUrl() {
|
||||
|
||||
let header ={
|
||||
id:'1234',
|
||||
bluePrint: '12312123',
|
||||
jwt: uuidv4()
|
||||
}
|
||||
|
||||
let wss: wss ={
|
||||
header,
|
||||
url: 'wss://synchro-server.herokuapp.com/ws/some_url/',
|
||||
type: 'reflect'
|
||||
}
|
||||
|
||||
this.url = `${wss.url}${wss.header.id}/${wss.header.jwt}/${wss.header.bluePrint}/${this.id}/`
|
||||
}
|
||||
|
||||
@@ -42,19 +56,27 @@ export class SynchroService {
|
||||
|
||||
private onopen = () =>{
|
||||
console.log('open ======================= welcome to socket server')
|
||||
// this.connection.send(JSON.stringify({user:'user1'}));
|
||||
|
||||
}
|
||||
|
||||
public $send = (object: any) => {
|
||||
let sendData = JSON.stringify(Object.assign({}, object));
|
||||
public $send(object: any) {
|
||||
|
||||
let message = {
|
||||
message: '{"person.adress.country":"1Angola"}',
|
||||
username: '',
|
||||
idConnection: this.id
|
||||
}
|
||||
|
||||
let sendData = JSON.stringify(Object.assign({}, message));
|
||||
|
||||
this.connection.send(sendData);
|
||||
}
|
||||
|
||||
private onmessage = async (event: any)=> {
|
||||
|
||||
this.callback()
|
||||
}
|
||||
|
||||
private onclose=(event:any)=>{
|
||||
private onclose=(event:any)=> {
|
||||
setTimeout(() => {
|
||||
if (event.wasClean) {
|
||||
console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
|
||||
@@ -72,3 +94,8 @@ export class SynchroService {
|
||||
console.log(`[error] ${event.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const connection = new SynchroService()
|
||||
connection.setUrl()
|
||||
connection.connect()
|
||||
Reference in New Issue
Block a user