mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
fix direct room
This commit is contained in:
@@ -9,6 +9,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.service'
|
||||
import { MessageEntity } from 'src/app/core/chat/entity/message';
|
||||
import { RoomType } from "src/app/core/chat/entity/group";
|
||||
import { RoomViewModel } from '../../../store/model/room';
|
||||
|
||||
@Component({
|
||||
selector: 'app-contacts',
|
||||
@@ -69,12 +70,12 @@ export class ContactsPage implements OnInit {
|
||||
async loadUsers() {
|
||||
|
||||
this.loading = true
|
||||
const getallChatUsers = await this.contactsRepositoryService.getUsers()
|
||||
const getallChatUsers = await this.chatServiceService.getContactList()
|
||||
|
||||
|
||||
if(getallChatUsers.isOk()) {
|
||||
|
||||
this.allChatUsers = getallChatUsers.value.data.result.sort((a,b) => {
|
||||
this.allChatUsers = getallChatUsers.value.sort((a,b) => {
|
||||
if(a.wxFullName < b.wxFullName) {
|
||||
return -1;
|
||||
}
|
||||
@@ -163,22 +164,34 @@ export class ContactsPage implements OnInit {
|
||||
this.modalController.dismiss({});
|
||||
}
|
||||
|
||||
select(user: UserContacts) {
|
||||
async select(user: UserContacts) {
|
||||
|
||||
const message = new MessageEntity();
|
||||
|
||||
message.sender = {
|
||||
userPhoto: '',
|
||||
wxeMail: SessionStore.user.Email,
|
||||
wxFullName: SessionStore.user.FullName,
|
||||
wxUserId: SessionStore.user.UserId
|
||||
// const result = await this.chatServiceService.sendMessage(message, RoomType.Direct)
|
||||
|
||||
const result = await this.chatServiceService.roomCreateLocalDirectMessage({
|
||||
roomName: user.wxFullName,
|
||||
receiverId: user.wxUserId,
|
||||
});
|
||||
|
||||
if(result.isOk()) {
|
||||
|
||||
const room = await this.chatServiceService.roomGetLocalById({
|
||||
$roomId: result.value
|
||||
})
|
||||
|
||||
if(room.isOk()) {
|
||||
|
||||
console.log('room', room)
|
||||
console.log('result.value', result.value)
|
||||
console.log('receiverId', user.wxUserId)
|
||||
|
||||
this.modalController.dismiss(new RoomViewModel(room.value))
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
}
|
||||
|
||||
message.receiverId = user.wxUserId
|
||||
|
||||
message.message = 'hello'
|
||||
|
||||
this.chatServiceService.sendMessage(message, RoomType.Group)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<div class="middle-container" *ngIf="!showMessageOptions">
|
||||
<div class="middle" >
|
||||
<ion-label *ngIf="roomData$ | async as roomData" class="title">{{ roomData.roomName }}</ion-label>
|
||||
<ion-label class="title">{{ room?.roomName }}</ion-label>
|
||||
<span *ngIf="roomStatus$ | async as roomStatus"><ion-icon *ngIf="roomStatus"
|
||||
class="online" name="ellipse"></ion-icon></span>
|
||||
</div>
|
||||
|
||||
@@ -55,6 +55,7 @@ import { LastMessage } from '../../utils/lastMessage';
|
||||
import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { FileSystemMobileService } from 'src/app/infra/file-system/mobile/file-system-mobile.service';
|
||||
import { RoomViewModel } from '../../store/model/room';
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -148,6 +149,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
IMessageType = IMessageType
|
||||
handleClickActive = false
|
||||
|
||||
room!: RoomViewModel
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
private modalController: ModalController,
|
||||
@@ -178,6 +181,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
this.roomId = this.navParams.get('roomId');
|
||||
|
||||
this.room = this.navParams.get('room');
|
||||
|
||||
console.log('room', this.room)
|
||||
|
||||
|
||||
this.roomData$ = this.RoomLocalRepository.getRoomByIdLive(this.roomId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user