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

This commit is contained in:
tiago.kayaya
2022-01-12 12:51:08 +01:00
19 changed files with 188 additions and 322 deletions
+7 -27
View File
@@ -10,10 +10,7 @@ import { AlertController } from '@ionic/angular';
import { SessionStore } from '../store/session.service';
import { AESEncrypt } from '../services/aesencrypt.service';
import { CookieService } from 'ngx-cookie-service';
import { RocketChatClientService } from '../services/socket/rocket-chat-client.service';
import { ChatService } from './chat.service';
import { WebsocketService } from './websocket.service';
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
@Injectable({
providedIn: 'root'
})
@@ -34,8 +31,7 @@ export class AuthService {
public alertController: AlertController,
private aesencrypt: AESEncrypt,
private cookieService: CookieService,
private wsService: WebsocketService,
private RocketChatClientService: RocketChatClientService) {
private WsChatService: WsChatService) {
this.headers = new HttpHeaders();
@@ -43,9 +39,9 @@ export class AuthService {
this.ValidatedUser = SessionStore.user
console.log('login', SessionStore.user.RochetChatUser, SessionStore.user.Password)
this.RocketChatClientService.connect(()=>{
this.WsChatService.connect(()=>{
this.RocketChatClientService.login({
this.WsChatService.login({
username: SessionStore.user.RochetChatUser,
password: SessionStore.user.Password
}).then((message) => {
@@ -114,22 +110,6 @@ export class AuthService {
this.ValidatedUser = null;
}
loginWsChat(){
let msg = {
"msg": "method",
"method": "login",
"id":"42",
"params":[
{
"user": { "username": "paulo.pinto" },
"password": "tabteste@006"
}
]
}
this.wsService.messages.next(msg);
this.isWsAuthenticated = true;
}
//Login to rocketChat server
async loginChat(user: UserForm): Promise<boolean> {
let postData = {
@@ -138,9 +118,9 @@ export class AuthService {
}
/* this.RocketChatClientService.connect(()=>{
this.WsChatService.connect(()=>{
this.RocketChatClientService.login({
this.WsChatService.login({
username: SessionStore.user.RochetChatUser,
password: user.password
}).then((message) => {
@@ -150,7 +130,7 @@ export class AuthService {
}).finally(()=>{
})
}) */
})
let responseChat = await this.httpService.post('login', postData).toPromise();