remove un used import

This commit is contained in:
Peter Maquiran
2023-06-22 12:53:35 +01:00
parent f849610b8c
commit 6ea40ab55f
37 changed files with 289 additions and 324 deletions
+47 -1
View File
@@ -20,6 +20,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { NetworkServiceService} from 'src/app/services/network-service.service';
import { ViewedMessageService } from './viewed-message.service'
import { NotificationsService } from '../notifications.service';
import { Subscribe } from '../subcribe';
@Injectable({
providedIn: 'root'
})
@@ -41,6 +42,9 @@ export class ChatSystemService {
sessionStore = SessionStore
delete = []
loadingUsers = false
onRoomsLoad = new Subscribe({execute : false, deleteOnExecute: true})
constructor(
private RochetChatConnectorService: RochetChatConnectorService,
@@ -299,7 +303,6 @@ export class ChatSystemService {
this.loadingWholeList = false
await this.storage.set('Rooms', rooms);
console.log('this._group', this._group)
this.sortRoomList()
@@ -311,6 +314,7 @@ export class ChatSystemService {
this.sortRoomList()
}, 10000)
this.onRoomsLoad.executor()
}
/**
@@ -687,4 +691,46 @@ export class ChatSystemService {
return this.RochetChatConnectorService.getUserOfRoom(roomId);
}
async createGroup(name) {
const res: any = await this.createPrivateRoom(name, SessionStore.user.UserName, {});
console.log('room is created', res)
if(res?.result?.rid) {
try {
await this.getAllRooms();
} catch (e) {}
console.log('room is loaded')
return res
} else {
return res
}
}
getGroupByName(name ) {
return this._group.find( e=> e.name == name)
}
async waitRoomToCreate(rid): Promise<RoomService> {
return new Promise(async (resolve, reject) => {
let sub;
sub = this.onRoomsLoad.subscribe(() => {
const room = this.getRoomById(rid)
if (room) {
resolve(room)
sub.unSubscribe()
}
})
try {
await this.getAllRooms();
} catch (e) {}
})
}
searchContact(name, username) {
return this.users.find( e=> e.name == name || e.username == username)
}
}