Fixe merge conflit

This commit is contained in:
Peter Maquiran
2021-01-19 08:52:43 +01:00
185 changed files with 6115 additions and 379 deletions
+9 -9
View File
@@ -35,6 +35,7 @@ export class AuthService {
if (result)
{
this.ValidatedUser = user;
}
return result;
}
@@ -49,26 +50,25 @@ export class AuthService {
return this.httpService.post('login', postData);
}
//Get user data from RocketChat
/* getUserData(){
//Get user data from RocketChat | global object
getUserData(){
this.storageService.get(AuthConnstants.AUTH).then(res=>{
this.userData$.next(res);
})
} */
});
}
/* getProfile(){
getProfile(){
this.storageService.get(AuthConnstants.PROFILE).then(res=>{
return res;
});
} */
}
logoutChat(){
//this.storageService.clear();
/* this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
this.userData$.next('');
this.router.navigate(['']);
}) */
})
}
}
+112 -4
View File
@@ -1,4 +1,4 @@
import { HttpHeaders } from '@angular/common/http';
import { HttpHeaders, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from "rxjs"
import { AuthService } from './auth.service';
@@ -6,6 +6,7 @@ import { HttpService } from './http.service';
import { StorageService } from './storage.service';
import { HttpClient, HttpHeaderResponse } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { Storage } from '@ionic/storage';
@Injectable({
providedIn: 'root'
@@ -13,14 +14,21 @@ import { environment } from 'src/environments/environment';
export class ChatService {
headers: HttpHeaders;
options:any;
options1:any;
X_User_Id:any;
X_Auth_Token:any;
constructor(
private http:HttpClient,
private httpService: HttpService,
private authService: AuthService,
private storage: Storage,
private storageService:StorageService,) {
this.headers = new HttpHeaders();
/* this.headers = this.headers.set('X-User-Id', 'GqjNWiLrGEHRna7Zn');
this.headers = this.headers.set('X-Auth-Token', 'dAM0ZOTAy8jzQA_vS25z2IrnSc6sYLfi5rmaa35YNUz'); */
-
this.authService.userData$.subscribe((res:any)=>{
this.headers = this.headers.set('X-User-Id', res.userId);
this.headers = this.headers.set('X-Auth-Token', res.authToken);
@@ -30,14 +38,114 @@ export class ChatService {
};
}
/* getUser(){
this.storage.get('user').then((val) => {
let user = JSON.parse(unescape(atob(val))).data;
this.headers = this.headers.set('X-User-Id', user.userId);
this.headers = this.headers.set('X-Auth-Token', user.authToken);
this.options1 = {
headers: this.headers,
};
console.log(this.options1);
this.http.get(environment.apiChatUrl+'users.presence', this.options1).subscribe(res => {
console.log(res);
});
});
} */
getAllDirectMessages(){
return this.http.get(environment.apiChatUrl+'im.list', this.options);
}
getAllChannels(){
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
}
getAllUserChannels(){
return this.http.get(environment.apiChatUrl+'channels.list.joined', this.options);
}
getAllRooms(){
return this.http.get(environment.apiChatUrl+'rooms.get', this.options);
}
getAllPrivateGroups(){
return this.http.get(environment.apiChatUrl+'groups.list', this.options);
}
getAllUsers(){
/* console.log(this.headers); */
return this.http.get(environment.apiChatUrl+'users.list', this.options);
}
getAllConnectedUsers(){
return this.http.get(environment.apiChatUrl+'users.presence', this.options);
}
getAllPrivateGroups(){
return this.http.get(environment.apiChatUrl+'groups.list', this.options);
//Check whether user is online or offline
getUserPresence(id:any){
let params = new HttpParams();
params = params.set("userId", id);
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'users.getPresence', opts);
}
//Load messages from roomId
loadJoinedRooms(){
return this.http.get(environment.apiChatUrl+'im.list', this.options);
}
//Load messages from roomId
getRoomMessages(roomId:any){
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'im.history', opts);
}
sendMessage(body:any){
let opts = {
headers: this.headers,
}
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
}
//Load members from a chat
getMembers(roomId:any){
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'im.members', opts);
}
removeChatRoom(body:any){
let opts = {
headers: this.headers,
}
return this.http.post(environment.apiChatUrl+'im.close', body, this.options);
}
createRoom(body:any){
return this.http.post(environment.apiChatUrl+'im.create', body, this.options);
}
getDirectMessage(roomId:string){
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'im.messages', opts);
}
}
+4 -4
View File
@@ -1,13 +1,13 @@
import { Injectable } from '@angular/core';
/* import { Plugins } from '@capacitor/core';
const { Storage } = Plugins; */
import { Plugins } from '@capacitor/core';
const { Storage } = Plugins;
@Injectable({
providedIn: 'root'
})
export class StorageService {
constructor() {}
/* // Store the value
// Store the value
async store(storageKey: string, value: any) {
const encryptedValue = btoa(escape(JSON.stringify(value)));
await Storage.set({
@@ -29,5 +29,5 @@ const { Storage } = Plugins; */
// Clear storage
async clear() {
await Storage.clear();
} */
}
}