This commit is contained in:
tiago.kayaya
2022-01-12 09:29:48 +01:00
parent f90773459c
commit d0b1401d42
7 changed files with 72 additions and 19 deletions
+3
View File
@@ -17,6 +17,9 @@
<ion-label class="title">Chat</ion-label>
</div>
<div class="div-icon">
<button class="btn-no-color" (click)="sendMsg()">
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src="assets/images/theme/gov/icons-chat-new-conversation.svg"></ion-icon>
</button>
<button class="btn-no-color" (click)="openContactsPage()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src="assets/images/icons-chat-new-conversation.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src="assets/images/theme/gov/icons-chat-new-conversation.svg"></ion-icon>
+9 -6
View File
@@ -31,6 +31,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
import { SqliteService } from 'src/app/services/sqlite.service';
import { StorageService } from 'src/app/services/storage.service';
import { WebsocketService } from 'src/app/services/websocket.service';
@@ -38,6 +39,7 @@ import { StorageService } from 'src/app/services/storage.service';
selector: 'app-chat',
templateUrl: './chat.page.html',
styleUrls: ['./chat.page.scss'],
providers: [WebsocketService, ChatService]
})
export class ChatPage implements OnInit {
@@ -123,7 +125,8 @@ export class ChatPage implements OnInit {
private router: Router,
private sqlservice: SqliteService,
private platform: Platform,
private storageservice: StorageService
private storageservice: StorageService,
private wsService: WebsocketService,
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
@@ -137,9 +140,9 @@ export class ChatPage implements OnInit {
console.log("CHAT PAGE");
/* chatService.messages.subscribe(msg => {
wsService.messages.subscribe(msg => {
console.log("Response from Websocket server: "+msg);
}); */
});
}
ngOnInit() {
@@ -157,7 +160,7 @@ export class ChatPage implements OnInit {
});
/* websocket functions */
this.sendMsg();
//this.sendMsg();
/* Fim websocket functions */
this.hideRefreshButton();
@@ -235,13 +238,13 @@ export class ChatPage implements OnInit {
loadMessage(){
this.chatService.messages.subscribe(msg => {
this.wsService.messages.subscribe(msg => {
console.log("Response from websocket: " + msg);
});
}
sendMsg() {
console.log("new message from client to websocket: ", this.message);
this.chatService.messages.next(this.message);
this.wsService.messages.next(this.message);
this.message.msg = "";
this.loadMessage();
}