diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts
index 195225832..c3496e88e 100644
--- a/src/app/pages/chat/chat.page.ts
+++ b/src/app/pages/chat/chat.page.ts
@@ -384,7 +384,7 @@ hideRefreshButton(){
this.chatService.getAllDirectMessages().subscribe(async (res:any)=>{
if(res != 200){
- console.log(res.ims);
+ //console.log(res.ims);
this.userDirectMessages = res.ims.sort((a,b)=>{
var dateA = new Date(a._updatedAt).getTime();
var dateB = new Date(b._updatedAt).getTime();
diff --git a/src/app/services/alert.service.ts b/src/app/services/alert.service.ts
index 1e9a09ba9..239c5d89c 100644
--- a/src/app/services/alert.service.ts
+++ b/src/app/services/alert.service.ts
@@ -1,5 +1,7 @@
import { Injectable } from '@angular/core';
import { AlertController, AnimationController } from '@ionic/angular';
+import { ChatService } from './chat.service';
+import { ToastService } from './toast.service';
@Injectable({
providedIn: 'root'
@@ -9,6 +11,8 @@ export class AlertService {
constructor(
public alertController: AlertController,
private animationController: AnimationController,
+ private chatService: ChatService,
+ private toastService: ToastService,
) { }
async presentAlert(message:string) {
@@ -30,10 +34,37 @@ export class AlertService {
});
await alert.present();
-
+
setTimeout(()=>{
alert.dismiss();
}, 2500);
}
+ async confirmDeleteMessage(body:any) {
+ const alert = await this.alertController.create({
+ cssClass: 'my-custom-class',
+ header: 'Apagar a mensagem?',
+ buttons: [
+ {
+ text: 'Cancelar',
+ role: 'cancel',
+ cssClass: 'secondary',
+ handler: () => {
+ //console.log('Confirm Cancel');
+ }
+ }, {
+ text: 'Apagar',
+ handler: () => {
+ const loader = this.toastService.loading();
+ this.chatService.deleteMessage(body).subscribe(res=>{
+ loader.remove();
+ });
+ }
+ }
+ ]
+ });
+
+ await alert.present();
+ }
+
}
diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts
index 440a2e978..910ffa9e1 100644
--- a/src/app/services/chat.service.ts
+++ b/src/app/services/chat.service.ts
@@ -52,6 +52,7 @@ export class ChatService {
getAllChannels(){
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
}
+
getAllUserChannels(){
return this.http.get(environment.apiChatUrl+'channels.list.joined', this.options);
}
@@ -59,6 +60,7 @@ export class ChatService {
getAllRooms(){
return this.http.get(environment.apiChatUrl+'rooms.get', this.options);
}
+
getRoomInfo(roomId:any){
let params = new HttpParams();
params = params.set("roomId", roomId);
@@ -110,6 +112,14 @@ export class ChatService {
}
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
}
+
+ deleteMessage(body:any){
+ let opts = {
+ headers: this.headers,
+ }
+ return this.http.post(environment.apiChatUrl+'chat.delete', body, opts);
+ }
+
leaveRoom(body:any){
let opts = {
headers: this.headers,
diff --git a/src/app/shared/chat/group-messages/group-messages.module.ts b/src/app/shared/chat/group-messages/group-messages.module.ts
index 5bb1d5128..990667f98 100644
--- a/src/app/shared/chat/group-messages/group-messages.module.ts
+++ b/src/app/shared/chat/group-messages/group-messages.module.ts
@@ -13,6 +13,7 @@ import { ChatPopoverPageModule } from '../../popover/chat-popover/chat-popover.m
import { NewEventPageModule } from '../../agenda/new-event/new-event.module';
import { PdfViewerModule } from 'ng2-pdf-viewer';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
+import {MatMenuModule} from '@angular/material/menu';
@NgModule({
imports: [
@@ -23,6 +24,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
PdfViewerModule,
ChatPopoverPageModule,
GroupMessagesPageRoutingModule,
+ MatMenuModule
//
],
exports: [GroupMessagesPage],
diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html
index 8f0f48428..26b7b88e3 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.html
+++ b/src/app/shared/chat/group-messages/group-messages.page.html
@@ -32,14 +32,20 @@
-
+
Esta conversa passou a grupo
A conversa original mantêm-se como chat individual
-
-
+
+
+
+
+
+
+
+
{{msg.u.name}}
{{showDateDuration(msg._updatedAt)}}
diff --git a/src/app/shared/chat/group-messages/group-messages.page.scss b/src/app/shared/chat/group-messages/group-messages.page.scss
index cfe8a412a..30facfa18 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.scss
+++ b/src/app/shared/chat/group-messages/group-messages.page.scss
@@ -131,8 +131,18 @@
.messages{
font-size: 13px;
font-family: Roboto;
+ overflow: auto;
+
+ //set scroll do bottom
+ position: absolute;
+ top: 0;
+ left: 0;
+ overflow-x: hidden;
+ overflow-y: auto;
width: 100%;
height: 100%;
+ word-wrap: break-word;
+ -webkit-overflow-scrolling: touch;
.incoming-true, .incoming-false{
padding: 15px 20px;
diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts
index 56849526b..3e4a60242 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.ts
+++ b/src/app/shared/chat/group-messages/group-messages.page.ts
@@ -319,6 +319,16 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
});
this.message = "";
}
+
+ deleteMessage(msgId:string){
+ let body = {
+ "roomId": this.roomId,
+ "msgId": msgId,
+ "asUser": false,
+ }
+ this.alertService.confirmDeleteMessage(body);
+ }
+
async openGroupMessagesOptions() {
const enterAnimation = (baseEl: any) => {
diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html
index 334324234..fa24adbf2 100644
--- a/src/app/shared/chat/messages/messages.page.html
+++ b/src/app/shared/chat/messages/messages.page.html
@@ -34,11 +34,9 @@
-
-
-
+
diff --git a/src/app/shared/chat/messages/messages.page.scss b/src/app/shared/chat/messages/messages.page.scss
index 127bf4a5c..2b0c755b4 100644
--- a/src/app/shared/chat/messages/messages.page.scss
+++ b/src/app/shared/chat/messages/messages.page.scss
@@ -117,10 +117,10 @@
word-wrap: break-word;
-webkit-overflow-scrolling: touch;
- .container-width-100{
+ /* .container-width-100{
width: 100%;
overflow: auto;
- }
+ } */
.incoming-true, .incoming-false{
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts
index ee5de9922..56b84fe71 100644
--- a/src/app/shared/chat/messages/messages.page.ts
+++ b/src/app/shared/chat/messages/messages.page.ts
@@ -192,6 +192,18 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.message = "";
}
+ deleteMessage(msgId:string){
+ let body = {
+ "roomId": this.roomId,
+ "msgId": msgId,
+ "asUser": false,
+ }
+ this.alertService.confirmDeleteMessage(body);
+ /* this.chatService.deleteMessage(body).subscribe(res=>{
+ console.log(res);
+ }); */
+ }
+
loadMessages(){
//this.showLoader = true;
const roomId = this.roomId
@@ -207,10 +219,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}); */
//this.showLoader = false;
})
- }2
-
- deleteMessage(){
- alert('This');
}
viewDocument(url:string){
@@ -404,17 +412,17 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const roomId = this.roomId;
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
- console.log(res['success']);
+ //console.log(res['success']);
if (res['success'] == true) {
// Show Error
//showMessage(response.statusText);
- //this.loadMessages()
+ this.loadMessages()
this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages)
- console.log(this.messages);
+ //console.log(this.messages);
// Reconnect in one second
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
diff --git a/src/global.scss b/src/global.scss
index cfbe38d49..2e58b81d5 100644
--- a/src/global.scss
+++ b/src/global.scss
@@ -1080,17 +1080,7 @@ ngx-mat-datetime-content{
display: none;
padding-left: 10px;
padding-right: 0px;
- position: absolute;
- //background-color: red;
-
- //box-shadow: rgba(0, 30, 0, 0.15) 1.95px 1.95px 2.6px;
- }
-
- .mesage-item-dropdown-options{
- display: none;
- margin-top: 15px;
- position: absolute;
- border: 1px solid red;
+ position: absolute !important;
}
}
@@ -1213,7 +1203,7 @@ ngx-mat-datetime-content{
.calendar-pr-event-type-Oficial{
border-right: 3px solid #99e47b !important;
}
-
+
.calendar-pr-event-type-Pessoal{
border-bottom: 3px solid #958bfc !important;
}