multiple changes

This commit is contained in:
tiago.kayaya
2022-01-14 10:35:54 +01:00
parent 99e3ea2452
commit 896af7fc49
9 changed files with 18 additions and 15 deletions
@@ -49,7 +49,7 @@
</ion-refresher-content>
</ion-refresher> -->
<div (click)="handleClick()" class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getRoom(this.roomId).massages; let last = last"
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getDmRoom(this.roomId).massages; let last = last"
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId" >
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)" *ngIf="msg.msg !=''">
<div class="title">
+1 -1
View File
@@ -108,7 +108,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
};
this.wsChatMethodsService.getRoom(this.roomId).loadHistory()
this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory()
}
+1 -2
View File
@@ -41,7 +41,6 @@ export class LoginPage implements OnInit {
private changeProfileService: ChangeProfileService,
public ThemeService: ThemeService,
private storageservice: StorageService,
private chatService: ChatService,
) {}
ngOnInit() {
@@ -102,7 +101,7 @@ export class LoginPage implements OnInit {
// login to API successfully
if (attempt) {
if (attempt.UserId == SessionStore.user.UserId) {
if (attempt.UserId == SessionStore.user.UserId) {
await this.authService.SetSession(attempt, this.userattempt);
await this.authService.loginChat(this.userattempt);
this.getToken();
+1 -1
View File
@@ -73,8 +73,8 @@ export class RoomService {
this.massages.push(wewMessage)
});
})
})
this.hasLoadHistory = true
}
@@ -88,12 +88,16 @@ export class WsChatMethodsService {
}
}
getRoom(id): RoomService {
getDmRoom(id): RoomService {
try {
return this.dm[id]
} catch(e) {
} catch(e) {}
}
getGroupRoom(id): RoomService {
try {
return this.group[id]
}
} catch(e) {}
}
getRoomName(roomData: room) {
@@ -44,7 +44,7 @@
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
</div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last">
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getGroupRoom(roomId).massages; let last = last">
<div class="message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru' && msg.msg !=''" >
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
@@ -90,7 +90,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
private fileService: FileService,
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef,
//public wsChatMethodsService: WsChatMethodsService
public wsChatMethodsService: WsChatMethodsService
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = true;
@@ -101,11 +101,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
ngOnChanges(changes: SimpleChanges): void {
this.getRoomInfo();
//this.scrollToBottom();
//this.wsChatMethodsService.getRoom(this.roomId).loadHistory();
this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory();
console.log('MESSAGES'+this.wsChatMethodsService.getGroupRoom(this.roomId).massages);
}
ngOnInit() {
alert('Here')
//console.log(this.wsChatMethodsService.getRoom(this.roomId).massages);
this.loggedUser=this.loggedUserChat;
@@ -37,7 +37,7 @@
</ion-refresher-content>
</ion-refresher>
<div class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getRoom(roomId).massages; let last = last">
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).massages; let last = last">
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45' *ngIf="msg.msg !=''">
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
@@ -84,7 +84,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.loggedUser = authService.ValidatedUserChat['data'];
}
ngOnChanges(changes: SimpleChanges): void {
this.wsChatMethodsService.getRoom(this.roomId).loadHistory()
this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory()
}
ngOnInit() {
@@ -214,7 +214,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
sendMessage() {
this.wsChatMethodsService.getRoom(this.roomId).send(this.message)
this.wsChatMethodsService.getDmRoom(this.roomId).send(this.message)
this.message = "";
}