mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
validate user permision on chat
This commit is contained in:
@@ -4,7 +4,8 @@ import { ChatServiceService } from 'src/app/module/chat/domain/chat-service.serv
|
||||
import { skip, switchMap } from 'rxjs/operators';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { Subject, timer } from 'rxjs';
|
||||
import { UserTypingLocalRepository } from './data/repository/user-typing-local-data-source.service';
|
||||
import { UserTypingLocalRepository } from './data/repository/typing/user-typing-local-data-source.service';
|
||||
import { UserTypingRemoteRepositoryService } from './data/repository/typing/user-typing-live-data-source.service';
|
||||
import { RoomService } from 'src/app/module/chat/domain/service/room.service'
|
||||
@NgModule({
|
||||
imports: [],
|
||||
@@ -22,6 +23,7 @@ export class ChatModule {
|
||||
private ChatServiceService: ChatServiceService,
|
||||
private signalR: SignalRService,
|
||||
private localDataSource: UserTypingLocalRepository,
|
||||
private UserTypingRemoteRepositoryService: UserTypingRemoteRepositoryService,
|
||||
private RoomService: RoomService
|
||||
) {
|
||||
|
||||
@@ -31,8 +33,7 @@ export class ChatModule {
|
||||
}
|
||||
|
||||
async listenToTyping() {
|
||||
this.signalR.getTyping().subscribe(async (e) => {
|
||||
if(e?.roomId) {
|
||||
this.UserTypingRemoteRepositoryService.listenToTyping().subscribe(async(e) => {
|
||||
|
||||
// this.memoryDataSource.dispatch(removeUserTyping({data: {...e} as any}))
|
||||
// this.memoryDataSource.dispatch(addUserTyping({data: {...e} as any}))
|
||||
@@ -52,9 +53,8 @@ export class ChatModule {
|
||||
} else {
|
||||
this.typingCallback[id].next()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async syncMessage() {
|
||||
@@ -62,14 +62,14 @@ export class ChatModule {
|
||||
|
||||
connection.pipe(
|
||||
skip(1) // Skip the first value
|
||||
).subscribe((value)=> {
|
||||
).subscribe((value: boolean)=> {
|
||||
if(value) {
|
||||
// on reconnect
|
||||
this.ChatServiceService.chatSync();
|
||||
}
|
||||
});
|
||||
|
||||
connection.subscribe((value) => {
|
||||
connection.subscribe((value: boolean) => {
|
||||
if(value) {
|
||||
// on connect
|
||||
// this.ChatServiceService.sendLocalMessages()
|
||||
|
||||
Reference in New Issue
Block a user