diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts
index cff860079..2a6c69e75 100644
--- a/src/app/pages/chat/chat.page.ts
+++ b/src/app/pages/chat/chat.page.ts
@@ -379,7 +379,7 @@ hideRefreshButton(){
async getDirectMessages(event?){
this.chatService.getAllDirectMessages().subscribe(async (res:any)=>{
- console.log(res.ims);
+ //console.log(res.ims);
if(res != 200){
//console.log(res.ims);
@@ -433,7 +433,7 @@ hideRefreshButton(){
async getGroups(event?){
this.result = this.chatService.getAllPrivateGroups().subscribe(async (res:any)=>{
- console.log(res);
+ //console.log(res);
if(res.groups != 200){
this.privateGroups = res.groups;
@@ -445,7 +445,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/pages/chat/group-messages/group-contacts/group-contacts.page.html b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html
index 734643f4d..0b571f4f3 100644
--- a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html
+++ b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html
@@ -11,7 +11,7 @@
Contactos
-
+
diff --git a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts
index 057ccf6ad..005d6775a 100644
--- a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts
+++ b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts
@@ -59,42 +59,6 @@ export class GroupContactsPage implements OnInit {
console.log(this.isGroupCreated);
}
- deleteMember(data:any){
- let body = {
- "roomId": this.room._id,
- "userId": data._id,
- }
- console.log(body);
- if(this.room.t == "p"){
- this.chatService.removeGroupMember(body).subscribe(res=>{
- console.log(res);
- this.getMembers();
- });
- }
- else if(this.room.t == "c"){
- this.chatService.removeChannelMember(body).subscribe(res=>{
- console.log(res);
- this.getMembers();
- });
- }
- }
-
- getMembers(){
- if(this.room.t == "p"){
- this.chatService.getGroupMembers(this.room._id).subscribe(res=>{
- this.members = res['members'];
- this.loadUsers();
- });
- }
- else if(this.room.t == "c"){
- this.chatService.getChannelMembers(this.room._id).subscribe(res=>{
- this.members = res['members'];
- this.loadUsers();
- });
- }
- }
-
-
loadUsers(){
this.options = {
headers: this.headers,
@@ -121,6 +85,21 @@ export class GroupContactsPage implements OnInit {
});
}
+ getMembers(){
+ if(this.room.t == "p"){
+ this.chatService.getGroupMembers(this.room._id).subscribe(res=>{
+ this.members = res['members'];
+ this.loadUsers();
+ });
+ }
+ else if(this.room.t == "c"){
+ this.chatService.getChannelMembers(this.room._id).subscribe(res=>{
+ this.members = res['members'];
+ this.loadUsers();
+ });
+ }
+ }
+
separateLetter(record, recordIndex, records){
if(recordIndex == 0){
return record.name[0];
@@ -135,6 +114,27 @@ export class GroupContactsPage implements OnInit {
return null;
}
+ deleteMember(data:any){
+ let body = {
+ "roomId": this.room._id,
+ "userId": data._id,
+ }
+ console.log(body);
+ if(this.room.t == "p"){
+ this.chatService.removeGroupMember(body).subscribe(res=>{
+ console.log(res);
+ this.getMembers();
+ });
+ }
+ else if(this.room.t == "c"){
+ this.chatService.removeChannelMember(body).subscribe(res=>{
+ console.log(res);
+ this.getMembers();
+ });
+ }
+ }
+
+
doRefresh(ev){
this.loadUsers();
this.getMembers();
@@ -143,26 +143,8 @@ export class GroupContactsPage implements OnInit {
async close(){
this.modalController.dismiss();
- if(this.isGroupCreated){
- console.log('go to conversa');
- }
- else{
- this.modalController.dismiss();
- console.log('go to new group page');
- const modal = await this.modalController.create({
- component: NewGroupPage,
- componentProps: {
- name:this.groupName,
- duration:'',
- },
- cssClass: 'new-group',
- backdropDismiss: false,
- });
- await modal.present();
-
- }
-
}
+
onChange(event){
this.textSearch = event.detail.value;
}
@@ -194,50 +176,21 @@ export class GroupContactsPage implements OnInit {
});
}
- createGroup(){
- if(!this.isGroupCreated){
- /* this.close(); */
- let body = { "name":this.groupName, }
- this.chatService.addGroup(body).subscribe(res=>{
- console.log('group created');
- console.log(res['group']);
- this.addContacts(res['group']);
- this.openGroupMessages(res['group']);
-
- });
-
- }
- else{
+ updateGroup(){
+ this.chatService.getRoomInfo(this.room._id).subscribe(room=>{
+ this.room = room['room'];
this.addContacts(this.room);
- this.close();
- /* this.openGroupMessages(this.room); */
- /* this.chatService.getGroupInfo(this.room._id).subscribe(res=>{
- console.log(res);
-
- this.addContacts(res['group']);
- this.openGroupMessages(res['group']);
- }) */
-
- }
- }
-
- async newGroup(){
- this.close();
- const modal = await this.modalController.create({
- component: NewGroupPage,
- cssClass: 'new-group',
- backdropDismiss: false,
+ this.openGroupMessages(room['room']._id);
});
- await modal.present();
- modal.onDidDismiss();
}
- async openGroupMessages(room:any){
+ async openGroupMessages(roomId:any){
this.close();
+ console.log(roomId);
const modal = await this.modalController.create({
component: GroupMessagesPage,
componentProps: {
- room: room,
+ roomId: roomId,
},
cssClass: 'group-messages',
backdropDismiss: false
diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html
index 2f0b9fc4c..41770d707 100644
--- a/src/app/pages/chat/group-messages/group-messages.page.html
+++ b/src/app/pages/chat/group-messages/group-messages.page.html
@@ -35,6 +35,10 @@
+
+
+ {{countDownDate(room.customFields.countDownDate, room._id)}}
+
diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts
index 0dfb1c570..85d112784 100644
--- a/src/app/pages/chat/group-messages/group-messages.page.ts
+++ b/src/app/pages/chat/group-messages/group-messages.page.ts
@@ -254,33 +254,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
showDateDuration(start:any){
return this.timeService.showDateDuration(start);
- /* let end;
- end = new Date();
- 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);
- const totalDays = Math.floor(totalHours/24);
-
- const hours = totalHours - ( totalDays * 24 );
- const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
- const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
-
- if(totalDays == 0){
- if(start.getDate() == new Date().getDate()){
- let time = start.getHours() + ":" + this.addZero(start.getUTCMinutes());
- return time;
- }
- else{
- return 'Ontem';
- }
- }
- else{
- let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear();
- return date;
- } */
+ }
+ countDownDate(date:any, roomId:string){
+ return this.timeService.countDownDate(date, roomId);
}
addZero(i) {
diff --git a/src/app/pages/chat/new-group/new-group.page.html b/src/app/pages/chat/new-group/new-group.page.html
index fe832cd20..f046ea010 100644
--- a/src/app/pages/chat/new-group/new-group.page.html
+++ b/src/app/pages/chat/new-group/new-group.page.html
@@ -11,7 +11,11 @@
Novo Grupo
-
+
+
+
@@ -22,7 +26,7 @@
-
+
Grupo Ultra-secreto
@@ -37,6 +41,6 @@
-
-
+
+
diff --git a/src/app/pages/chat/new-group/new-group.page.scss b/src/app/pages/chat/new-group/new-group.page.scss
index a5420829d..46bb28495 100644
--- a/src/app/pages/chat/new-group/new-group.page.scss
+++ b/src/app/pages/chat/new-group/new-group.page.scss
@@ -32,7 +32,7 @@ ion-content{
float: right;
margin-right: 10px;
}
-
+
}
.main-header{
width: 100%; /* 400px */
@@ -45,7 +45,7 @@ ion-content{
padding: 30px 20px 0px 20px;
color:#000;
transform: translate3d(0, 1px, 0);
-
+
.title-content{
margin: 0px auto;
overflow: auto;
@@ -64,6 +64,13 @@ ion-content{
width: 221px;
margin: 2.5px 0 0 5px;
}
+ .btn-criar{
+ padding: 0!important;
+ float: right;
+ font-size: 15px;
+ color: var(--font-awesome);
+ margin: 8px 5px 0 5px;
+ }
.right{
padding: 0!important;
float: right;
@@ -87,8 +94,8 @@ ion-content{
float: right;
padding-left: 20px;
}
-
-
+
+
}
.main-content{
width: 100%; /* 400px */
diff --git a/src/app/pages/chat/new-group/new-group.page.ts b/src/app/pages/chat/new-group/new-group.page.ts
index ed270433d..7ef8adb6f 100644
--- a/src/app/pages/chat/new-group/new-group.page.ts
+++ b/src/app/pages/chat/new-group/new-group.page.ts
@@ -4,6 +4,7 @@ import { ModalController, NavParams, PickerController, PopoverController } from
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
import { ThemeService } from 'src/app/services/theme.service'
+import { ChatService } from 'src/app/services/chat.service';
@Component({
selector: 'app-new-group',
@@ -16,6 +17,7 @@ export class NewGroupPage implements OnInit {
displayDuration: any;
showDuration: boolean;
selectedDuration = ['','',''];
+ thedate:any;
groupName:string;
constructor(
@@ -23,9 +25,10 @@ export class NewGroupPage implements OnInit {
private popoverController: PopoverController,
private modalController: ModalController,
private navParams: NavParams,
- public ThemeService: ThemeService
- )
- {
+ public ThemeService: ThemeService,
+ private chatService: ChatService,
+ )
+ {
this.isGroupCreated = false;
this.groupName = this.navParams.get('name');
}
@@ -35,24 +38,54 @@ export class NewGroupPage implements OnInit {
}
_ionChange(event){
this.showDuration = event.detail.checked;
+
+ if(event.detail.checked){
+ this.thedate = new Date();
+ }
+ else{
+ this.thedate = '';
+ }
}
close(){
this.modalController.dismiss();
}
- async addContacts(){
+ createGroup(){
+ let name = this.groupName.split(' ').join('-');
+ let body = { "name":name, }
+ this.chatService.addGroup(body).subscribe(res=>{
+ console.log('group created');
+ console.log(res['group']);
+
+ //this.addGroupMessage.emit(res['group']._id);
+
+ if(this.thedate){
+ let countDownBody = {
+ "roomId": res['group']._id,
+ "customFields":{"countDownDate":this.thedate}
+ }
+ this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
+ console.log(res);
+ });
+ }
+
+ this.isGroupCreated = true;
+ this.addContacts(res['group']);
+
+ });
+ }
+
+ async addContacts(room){
this.close();
let name = this.groupName.split(' ').join('-');
console.log(name);
-
+
const modal = await this.modalController.create({
component: GroupContactsPage,
componentProps: {
- isCreated:this.isGroupCreated,
- name: name,
- duration:'',
- },
+ room: room,
+ },
cssClass: 'contacts',
backdropDismiss: false
});
@@ -60,7 +93,7 @@ export class NewGroupPage implements OnInit {
await modal.present();
modal.onDidDismiss();
}
-
+
async setDuration(ev: any) {
const popover = await this.popoverController.create({
component: GroupDurationPage,
@@ -75,14 +108,17 @@ export class NewGroupPage implements OnInit {
const picker = await this.pickerController.create({
cssClass: '',
buttons: [
- {
+ {
text: 'Cancelar', role: 'cancel', cssClass: 'btn-cancel'
},
- {
- text: 'Ok',
+ {
+ text: 'Ok',
cssClass: 'btn-cancel',
handler:(value:any)=>{
console.log('button done pressed');
+ let now = new Date();
+ this.thedate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds());
+
this.selectedDuration = [
value.days.value,
value.hours.value,
@@ -93,24 +129,24 @@ export class NewGroupPage implements OnInit {
if(value.days.value > 0){
if(value.days.value == 1){
if(value.hours.value == 1){
- this.displayDuration = value.days.value + " day " +
+ this.displayDuration = value.days.value + " day " +
value.hours.value + " hora " +
value.minutes.value + " minutos";
}
else{
- this.displayDuration = value.days.value + " days " +
+ this.displayDuration = value.days.value + " days " +
value.hours.value + " horas " +
value.minutes.value + " minutos";
}
}
else{
if(value.hours.value == 1){
- this.displayDuration = value.days.value + " days " +
+ this.displayDuration = value.days.value + " days " +
value.hours.value + " hora " +
value.minutes.value + " minutos";
}
else{
- this.displayDuration = value.days.value + " days " +
+ this.displayDuration = value.days.value + " days " +
value.hours.value + " horas " +
value.minutes.value + " minutos";
}
@@ -126,7 +162,7 @@ export class NewGroupPage implements OnInit {
value.minutes.value + " minutos";
}
}
- }
+ }
},
},
],
@@ -180,7 +216,7 @@ export class NewGroupPage implements OnInit {
await picker.present();
picker.onDidDismiss().then(async data =>{
let day = await picker.getColumn('days');
- let hour = await picker.getColumn('hours');
+ let hour = await picker.getColumn('hours');
let minutes = await picker.getColumn('minutes');
});
diff --git a/src/app/services/functions/time.service.ts b/src/app/services/functions/time.service.ts
index f94877e87..421c53981 100644
--- a/src/app/services/functions/time.service.ts
+++ b/src/app/services/functions/time.service.ts
@@ -43,7 +43,6 @@ 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));
diff --git a/src/app/shared/chat/new-group/new-group.page.html b/src/app/shared/chat/new-group/new-group.page.html
index 6d5b409e7..a4be2d603 100644
--- a/src/app/shared/chat/new-group/new-group.page.html
+++ b/src/app/shared/chat/new-group/new-group.page.html
@@ -21,12 +21,12 @@
-
+
Grupo Ultra-secreto
-
-
+
+
-
{{displayDuration}}
-
-
{{thedate}}
-
-
{{countDownTime}}
-
diff --git a/src/app/shared/chat/new-group/new-group.page.ts b/src/app/shared/chat/new-group/new-group.page.ts
index 7c2d367a0..1c183a0cd 100644
--- a/src/app/shared/chat/new-group/new-group.page.ts
+++ b/src/app/shared/chat/new-group/new-group.page.ts
@@ -42,12 +42,16 @@ export class NewGroupPage implements OnInit {
_ionChange(event){
console.log(event);
console.log(event.detail.checked);
+ this.showDuration = event.detail.checked;
- this.showDuration = event.detail.checked;
- //this.thedate = new Date(2021, 10, 1, 10, 33, 30, 0);
- this.thedate = new Date();
-
+ if(event.detail.checked){
+ this.thedate = new Date();
+ }
+ else{
+ this.thedate = '';
+ }
}
+
close(){
//this.modalController.dismiss();
console.log('close');
@@ -63,13 +67,15 @@ export class NewGroupPage implements OnInit {
this.addGroupMessage.emit(res['group']._id);
- let countDownBody = {
- "roomId": res['group']._id,
- "customFields":{"countDownDate":this.thedate}
+ if(this.thedate){
+ let countDownBody = {
+ "roomId": res['group']._id,
+ "customFields":{"countDownDate":this.thedate}
+ }
+ this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
+ console.log(res);
+ });
}
- this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
- console.log(res);
- });
});
}
diff --git a/src/theme/variables.scss b/src/theme/variables.scss
index c82a36ab6..8ca5f0eb3 100644
--- a/src/theme/variables.scss
+++ b/src/theme/variables.scss
@@ -627,6 +627,9 @@ body {
--indicator-color: transparent !important;
--indicator-color-checked: transparent !important;
}
+.yellow-orange{
+ color: #ffb703 !important;
+}
.tribunal {
--ion-color-primary: #000;