mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
save
This commit is contained in:
@@ -6,6 +6,8 @@ import { GroupContactsPage } from '../group-messages/group-contacts/group-contac
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-group',
|
||||
@@ -21,6 +23,7 @@ export class NewGroupPage implements OnInit {
|
||||
thedate:any;
|
||||
groupName:string;
|
||||
documents:any;
|
||||
loggedUserChat: any;
|
||||
|
||||
constructor(
|
||||
private pickerController: PickerController,
|
||||
@@ -30,8 +33,11 @@ export class NewGroupPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private chatService: ChatService,
|
||||
private processesService: ProcessesService,
|
||||
public wsChatMethodsService: WsChatMethodsService,
|
||||
private authService: AuthService,
|
||||
)
|
||||
{
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.isGroupCreated = false;
|
||||
this.groupName = this.navParams.get('name');
|
||||
this.documents = this.navParams.get('documents');
|
||||
@@ -55,10 +61,34 @@ export class NewGroupPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
createGroup(){
|
||||
async createGroup(){
|
||||
let name = this.groupName.split(' ').join('-');
|
||||
//Take out all special characters in string
|
||||
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||
|
||||
let customFields = {}
|
||||
let res:any;
|
||||
|
||||
if(this.thedate){
|
||||
let customFields = {
|
||||
"countDownDate":this.thedate
|
||||
}
|
||||
res = await this.wsChatMethodsService.createPrivateRoom(name, this.loggedUserChat.me.username, customFields);
|
||||
console.log(res);
|
||||
}
|
||||
else{
|
||||
res = await this.wsChatMethodsService.createPrivateRoom(name, this.loggedUserChat.me.username, customFields);
|
||||
console.log(res);
|
||||
}
|
||||
|
||||
this.isGroupCreated = true;
|
||||
this.addContacts(res.result);
|
||||
|
||||
this.wsChatMethodsService.subscribeToRoomUpdate(res.result.rid, res.result);
|
||||
|
||||
//this.addGroupMessage.emit(res.result.rid);
|
||||
|
||||
/*
|
||||
let body = { "name":name, }
|
||||
this.chatService.addGroup(body).subscribe(res=>{
|
||||
console.log('group created');
|
||||
@@ -112,7 +142,7 @@ export class NewGroupPage implements OnInit {
|
||||
this.chatService.sendMessage(body).toPromise();
|
||||
});
|
||||
}
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
async addContacts(room){
|
||||
|
||||
Reference in New Issue
Block a user