diff --git a/src/app/components/family-connect/family-connect.component.html b/src/app/components/family-connect/family-connect.component.html index a33494a..b0f5d59 100644 --- a/src/app/components/family-connect/family-connect.component.html +++ b/src/app/components/family-connect/family-connect.component.html @@ -3,7 +3,7 @@ You have an invitation waiting - + {{fromData.firstname}} is waiting... diff --git a/src/app/components/family-connect/family-connect.component.ts b/src/app/components/family-connect/family-connect.component.ts index aedc92b..ca04099 100644 --- a/src/app/components/family-connect/family-connect.component.ts +++ b/src/app/components/family-connect/family-connect.component.ts @@ -45,12 +45,16 @@ connectStart : number = 0; //this.call_active = false; }, 10000); } + + acceptConnect(currentConnectData){ + console.log(currentConnectData); + alert(100000); + } ngOnInit() { this.getFamilyList(); } startfamilyConnect(){ - // alert("start connect"); this.connectStart = 100; } @@ -61,8 +65,7 @@ connectStart : number = 0; } sendInvite(){ - console.log(this.select_activity); - this.socketToolsService.familyInvite(this.currentInvite); + this.socketToolsService.familyInvite(this.currentInvite,this.select_activity); this.call_active = true; setTimeout(()=>{ this.call_active = false; diff --git a/src/app/services/socket-tools.service.ts b/src/app/services/socket-tools.service.ts index 9ac6ddc..5615c33 100644 --- a/src/app/services/socket-tools.service.ts +++ b/src/app/services/socket-tools.service.ts @@ -24,15 +24,35 @@ export class SocketToolsService { this.socket.connect(); } - public familyInvite(item){ + public familyInviteConnect(item){ console.log(item); const msgPart = { - type: 'FAMILY_INVITE', + type: 'FAMILY_INVITE_CONNECT', + target_room: this.sessionDataProviderService.session+'-'+item.uid, from: item }; let Vv = this.sessionDataProviderService.getFamilyRoom()+"-"+item.uid; - this.emmitSocketEvent("send_message",msgPart, Vv); + this.emmitSocketEvent("send_message",msgPart, Vv); } + + + public familyInvite(item, activitySelect:string){ + // console.log(item); + const msgPart = { + type: 'FAMILY_INVITE', + activity: activitySelect, + target_room: this.sessionDataProviderService.session+'-'+item.uid, + from: item + }; + let targetPrivateRoom = this.sessionDataProviderService.getFamilyRoom()+"-"+item.uid; + this.emmitSocketEvent("send_message",msgPart, targetPrivateRoom); + // note that target room is where we will chat or connect to talk + // after sending the message for invite , wait in the room + setTimeout(()=>{ + this.joinSocketRoom( msgPart.target_room); // this is the room where we will talk or connect + }, 2000); + } + public joinSocketRoom(socketRoom){ this.socket.emit("join_room", socketRoom); }