Merge branch 'feature/chat' of https://bitbucket.org/equilibriumito/gabinete-digital into feature/chat

This commit is contained in:
Eudes Inácio
2021-07-26 10:52:22 +01:00
13 changed files with 113 additions and 103 deletions
+50 -50
View File
@@ -20,8 +20,8 @@ export class ChatService {
X_User_Id:any;
X_Auth_Token:any;
SERVER_URL = 'wss://www.tabularium.pt/websocket';
public messages: Subject<any>;
//SERVER_URL = 'wss://www.tabularium.pt/websocket';
//public messages: Subject<any>;
loggedUserChat:any;
bindOnMessage: any;
@@ -31,7 +31,7 @@ export class ChatService {
private authService: AuthService,
private storage: Storage,
private storageService:StorageService,
private wsService: WebsocketService,
//private wsService: WebsocketService,
)
{
this.loggedUserChat = authService.ValidatedUserChat;
@@ -42,13 +42,13 @@ export class ChatService {
headers: this.headers,
};
this.messages = <Subject<any>>this.wsService.connect(this.SERVER_URL).map((response: MessageEvent): any => {
/* this.messages = <Subject<any>>this.wsService.connect(this.SERVER_URL).map((response: MessageEvent): any => {
let data = JSON.parse(response.data);
console.log(data);
return (JSON.stringify(data));
});
}); */
}
getAllChannels(){
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
}
@@ -62,17 +62,17 @@ export class ChatService {
getRoomInfo(roomId:any){
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'rooms.info', opts);
}
customsRooms(params:any){
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'rooms.get', opts);
}
@@ -96,22 +96,22 @@ export class ChatService {
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'im.history', opts);
}
sendMessage(body:any){
let opts = {
let opts = {
headers: this.headers,
}
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
}
leaveRoom(body:any){
let opts = {
let opts = {
headers: this.headers,
}
return this.http.post(environment.apiChatUrl+'rooms.leave', body, opts);
@@ -121,15 +121,15 @@ export class ChatService {
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'im.members', opts);
}
removeChatRoom(body:any){
let opts = {
let opts = {
headers: this.headers,
}
return this.http.post(environment.apiChatUrl+'im.close', body, this.options);
@@ -140,10 +140,10 @@ export class ChatService {
getDirectMessage(roomId:string){
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'im.messages', opts);
}
@@ -156,10 +156,10 @@ export class ChatService {
let params = new HttpParams();
let url=environment.apiChatUrl+'groups.members';
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(url, opts);
}
@@ -167,10 +167,10 @@ export class ChatService {
let params = new HttpParams();
let url=environment.apiChatUrl+'channels.members';
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(url, opts);
}
@@ -179,20 +179,20 @@ export class ChatService {
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'groups.history', opts);
}
getPublicGroupMessages(roomId:any){
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'channels.history', opts);
}
@@ -209,7 +209,7 @@ export class ChatService {
return this.http.post(environment.apiChatUrl+'channels.leave', body, this.options);
}
removeChannelMember(body:any){
let opts = {
let opts = {
headers: this.headers,
}
return this.http.post(environment.apiChatUrl+'channels.kick', body, opts);
@@ -226,10 +226,10 @@ export class ChatService {
getGroupInfo(roomId:any){
let params = new HttpParams();
params = params.set("roomId", roomId);
let opts = {
headers: this.headers,
params: params
let opts = {
headers: this.headers,
params: params
}
return this.http.get(environment.apiChatUrl+'groups.info', opts);
}
@@ -237,7 +237,7 @@ export class ChatService {
return this.http.post(environment.apiChatUrl+'groups.rename', body, this.options);
}
removeGroupMember(body:any){
let opts = {
let opts = {
headers: this.headers,
}
return this.http.post(environment.apiChatUrl+'groups.kick', body, opts);