{{group.lastMessage.u.name}}: {{group.lastMessage.msg}}
diff --git a/src/app/pages/chat/chat.page.scss b/src/app/pages/chat/chat.page.scss
index 50c2afa74..9a19cdb15 100644
--- a/src/app/pages/chat/chat.page.scss
+++ b/src/app/pages/chat/chat.page.scss
@@ -98,7 +98,7 @@ ion-content{
margin-top: 10px;
}
.item-title{
- width: calc(100% - 75px);
+ width: calc(100% - 80px);
float: left;
font-size: 15px;
color: #0d89d1;
@@ -107,7 +107,7 @@ ion-content{
color: #fff;
}
.item-date{
- width: 75px;
+ width: 80px;
float: right;
font-size: 13px;
color: #797979;
diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts
index 991abb5a2..66c5d8a7e 100644
--- a/src/app/pages/chat/chat.page.ts
+++ b/src/app/pages/chat/chat.page.ts
@@ -420,6 +420,10 @@ hideRefreshButton(){
return this.timeService.showDateDuration(start);
}
+ countDownDate(date:any, roomId:string){
+ return this.timeService.countDownDate(date, roomId);
+ }
+
async getChatMembers(){
//return await this.chatService.getMembers(roomId).toPromise();
this.chatService.getAllUsers().subscribe(res=> {
@@ -432,7 +436,7 @@ hideRefreshButton(){
async getGroups(event?){
this.result = this.chatService.getAllPrivateGroups().subscribe(async (res:any)=>{
-
+ console.log(res);
if(res.groups != 200){
this.privateGroups = res.groups;
@@ -444,7 +448,7 @@ hideRefreshButton(){
var dateB = new Date(b._updatedAt).getTime();
return dateB - dateA;
});
- //console.log(this.allGroups);
+ console.log(this.allGroups);
/* }); */
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts
index 0b05b66eb..16c07557c 100644
--- a/src/app/services/chat.service.ts
+++ b/src/app/services/chat.service.ts
@@ -209,8 +209,12 @@ export class ChatService {
/* GROUPS */
addGroup(body:any){
+ console.log(body);
return this.http.post(environment.apiChatUrl+'groups.create', body, this.options);
}
+ setGroupCustomFields(body:any){
+ return this.http.post(environment.apiChatUrl+'groups.setCustomFields', body, this.options);
+ }
getGroupMembers(roomId:string){
let params = new HttpParams();
@@ -223,6 +227,7 @@ export class ChatService {
}
return this.http.get(url, opts);
}
+
getChannelMembers(roomId:string){
let params = new HttpParams();
let url=environment.apiChatUrl+'channels.members';
@@ -274,9 +279,11 @@ export class ChatService {
}
return this.http.post(environment.apiChatUrl+'channels.kick', body, opts);
}
+
deleteGroup(body:any){
return this.http.post(environment.apiChatUrl+'groups.delete', body, this.options);
}
+
deleteChannel(body:any){
return this.http.post(environment.apiChatUrl+'channels.delete', body, this.options);
}
diff --git a/src/app/services/functions/time.service.ts b/src/app/services/functions/time.service.ts
index 33e8719cc..f94877e87 100644
--- a/src/app/services/functions/time.service.ts
+++ b/src/app/services/functions/time.service.ts
@@ -1,11 +1,14 @@
import { Injectable } from '@angular/core';
+import { ChatService } from '../chat.service';
@Injectable({
providedIn: 'root'
})
export class TimeService {
+ countDownTime: any;
+ room: any;
- constructor() { }
+ constructor(private chatService: ChatService) { }
showDateDuration(start:any){
let end;
@@ -13,6 +16,7 @@ export class TimeService {
start = new Date(start);
let customizedDate;
+
const totalSeconds = Math.floor((end - (start))/1000);;
const totalMinutes = Math.floor(totalSeconds/60);
const totalHours = Math.floor(totalMinutes/60);
@@ -37,6 +41,40 @@ export class TimeService {
}
}
+ countDownDate(date:any, roomId:string){
+ /* let timer = setInterval(() =>{ */
+ console.log('Show TIMER');
+ let difference = new Date(date).getTime() - new Date().getTime();
+ let c_day = Math.floor(difference/(1000*60*60*24));
+ let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60));
+ let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60));
+ let c_seconds = Math.floor((difference % (1000*60)) / 1000);
+
+ this.countDownTime = c_day + " : " + c_hours + " : " + c_minutes + " : " + c_seconds ;
+
+ if(difference < 0){
+ //clearInterval(timer);
+ this.countDownTime = "Expired";
+ let body = { "roomId":roomId, }
+ this.chatService.getRoomInfo(roomId).subscribe(room=>{
+ this.room = room['room'];
+
+ if(this.room.t === 'p'){
+ this.chatService.deleteGroup(body).subscribe(res=>{
+ console.log(res);
+ });
+ }
+ else{
+ this.chatService.deleteChannel(body).subscribe(res=>{
+ console.log(res);
+ });
+ }
+ });
+ }
+ //})
+ return this.countDownTime;
+ }
+
addZero(i) {
if (i < 10) {
i = "0" + i;
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 f186c0e6a..1e8c3d427 100644
--- a/src/app/shared/chat/group-messages/group-messages.page.html
+++ b/src/app/shared/chat/group-messages/group-messages.page.html
@@ -21,6 +21,10 @@
+