This commit is contained in:
Peter Maquiran
2022-09-26 16:16:37 +01:00
parent 89c274ac4b
commit bf60b355fe
10 changed files with 150 additions and 36 deletions
+4
View File
@@ -245,6 +245,10 @@ const routes = [
{
path: 'diplomas-gerar-options',
loadChildren: () => import('./shared/popover/diplomas-gerar-options/diplomas-gerar-options.module').then( m => m.DiplomasGerarOptionsPageModule)
},
{
path: 'chat-debugging',
loadChildren: () => import('./shared/popover/chat-debugging/chat-debugging.module').then( m => m.ChatDebuggingPageModule)
}
/*
+4
View File
@@ -17,6 +17,10 @@
<ion-label class="title">Chat</ion-label>
</div>
<div class="div-icon">
<button (click)="openChatDebuggingPageModal()" title="Nova Conversa Individual" class="btn-no-color font-12">
Dev
</button>
<button title="Nova Conversa Individual" 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>
+16 -3
View File
@@ -9,7 +9,7 @@ import {
import { ModalController, Platform } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { WsChatMethodsService} from 'src/app/services/chat/ws-chat-methods.service'
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'
import { GroupMessagesPage } from './group-messages/group-messages.page';
import { ContactsPage } from './messages/contacts/contacts.page';
import { MessagesPage } from './messages/messages.page';
@@ -26,7 +26,7 @@ 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 { SessionStore } from 'src/app/store/session.service';
import { ChatDebuggingPage } from 'src/app/shared/popover/chat-debugging/chat-debugging.page';
@Component({
@@ -137,7 +137,6 @@ export class ChatPage implements OnInit {
this.authService.userData$.subscribe((res: any) => {
this.loggedUser = res;
});
this.hideRefreshButton();
@@ -730,6 +729,20 @@ export class ChatPage implements OnInit {
modal.onDidDismiss();
}
async openChatDebuggingPageModal(roomId?: any) {
const modal = await this.modalController.create({
component: ChatDebuggingPage,
cssClass: 'modal modal-desktop isMessagesChatOpened',
componentProps: {
// roomId: roomId,
},
});
await modal.present();
modal.onDidDismiss();
}
async openGroupMessagesModal(roomId: any) {
const modal = await this.modalController.create({
@@ -169,45 +169,50 @@ export class WsChatMethodsService {
} catch(e) {}
await rooms.result.update.forEach( async (roomData: room, index) => {
const roomId = this.getRoomId(roomData);
if(roomData.t == 'd') {
const res = await this.chatService.getMembers(roomId).toPromise();
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
await this.prepareRoom(roomData);
} else {
if (roomData.t === 'p') {
const res = await this.chatService.getGroupMembers(roomId).toPromise()
try {
await rooms.result.update.forEach( async (roomData: room, index) => {
const roomId = this.getRoomId(roomData);
if(roomData.t == 'd') {
const res = await this.chatService.getMembers(roomId).toPromise();
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
await this.prepareRoom(roomData);
} else {
if (roomData.t === 'p') {
const res = await this.chatService.getGroupMembers(roomId).toPromise()
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
await this.prepareRoom(roomData);
}
else {
const res = await this.chatService.getChannelMembers(roomId).toPromise()
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
await this.prepareRoom(roomData);
}
}
else {
const res = await this.chatService.getChannelMembers(roomId).toPromise()
const members = res['members'];
const users = members.filter(data => data.username != this.sessionStore.user.UserName);
rooms.result.update[index]['members'] = users
await this.prepareRoom(roomData);
}
}
});
await this.storage.set('Rooms', rooms);
});
await this.storage.set('Rooms', rooms);
} catch (e) {
console.log(e, "error");
}
setTimeout(() => {
this.sortRoomList()
}, 1000)
@@ -218,6 +223,7 @@ export class WsChatMethodsService {
}, 10000)
this.loadingWholeList = false
}
/**
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ChatDebuggingPage } from './chat-debugging.page';
const routes: Routes = [
{
path: '',
component: ChatDebuggingPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ChatDebuggingPageRoutingModule {}
@@ -0,0 +1,20 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ChatDebuggingPageRoutingModule } from './chat-debugging-routing.module';
import { ChatDebuggingPage } from './chat-debugging.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ChatDebuggingPageRoutingModule
],
declarations: [ChatDebuggingPage]
})
export class ChatDebuggingPageModule {}
@@ -0,0 +1,9 @@
<ion-content>
<ul>
<li>Chat login</li>
<li>Chat user list</li>
</ul>
<ul>
<!-- <li *ngFor="let room of wsChatMethodsService._dm">chat Name: {{room.name}}; subcribe: {{room.status.receive.message}}; </li> -->
</ul>
</ion-content>
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ChatDebuggingPage } from './chat-debugging.page';
describe('ChatDebuggingPage', () => {
let component: ChatDebuggingPage;
let fixture: ComponentFixture<ChatDebuggingPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ChatDebuggingPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ChatDebuggingPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
import { WsChatMethodsService} from 'src/app/services/chat/ws-chat-methods.service';
@Component({
selector: 'app-chat-debugging',
templateUrl: './chat-debugging.page.html',
styleUrls: ['./chat-debugging.page.scss'],
})
export class ChatDebuggingPage implements OnInit {
constructor(
public wsChatMethodsService: WsChatMethodsService
) { }
ngOnInit() {}
}