@@ -12,7 +12,9 @@ import {
12
12
booleanExposingStateControl ,
13
13
jsonObjectExposingStateControl ,
14
14
numberExposingStateControl ,
15
+ numberStateControl ,
15
16
stringExposingStateControl ,
17
+ stringStateControl ,
16
18
} from "comps/controls/codeStateControl" ;
17
19
import { PositionControl } from "comps/controls/dropdownControl" ;
18
20
import {
@@ -274,13 +276,14 @@ export const meetingControllerChildren = {
274
276
endCall : booleanExposingStateControl ( "false" ) ,
275
277
sharing : booleanExposingStateControl ( "false" ) ,
276
278
videoSettings : jsonObjectExposingStateControl ( "" ) ,
277
- videoWidth : numberExposingStateControl ( "videoWidth" , 200 ) ,
278
- videoHeight : numberExposingStateControl ( "videoHeight" , 200 ) ,
279
+ videoWidth : numberStateControl ( 200 ) ,
280
+ videoHeight : numberStateControl ( 200 ) ,
279
281
appId : withDefault ( StringControl , trans ( "meeting.appid" ) ) ,
280
282
participants : stateComp < JSONValue > ( [ ] ) ,
281
283
usersScreenShared : stateComp < JSONValue > ( [ ] ) ,
282
284
localUser : jsonObjectExposingStateControl ( "" ) ,
283
- meetingName : stringExposingStateControl ( "meetingName" ) ,
285
+ meetingName : stringStateControl ( "meetingName" ) ,
286
+ userName : stringStateControl ( "userName" ) ,
284
287
certifiCateKey : stringExposingStateControl ( "" ) ,
285
288
messages : stateComp < JSONValue > ( [ ] ) ,
286
289
} ;
@@ -314,6 +317,12 @@ let MTComp = (function () {
314
317
) ;
315
318
} , [ userIds ] ) ;
316
319
320
+ useEffect ( ( ) => {
321
+ dispatch (
322
+ changeChildAction ( "participants" , getData ( userIds ) . data , false )
323
+ ) ;
324
+ } , [ userIds ] ) ;
325
+
317
326
useEffect ( ( ) => {
318
327
if ( props . endCall . value ) {
319
328
let newUsers = userIds . filter ( ( item : any ) => item . user !== userId ) ;
@@ -331,6 +340,19 @@ let MTComp = (function () {
331
340
}
332
341
} , [ rtmMessages ] ) ;
333
342
343
+ useEffect ( ( ) => {
344
+ if ( props . localUser . value ) {
345
+ let newUsers = userIds . filter ( ( item : any ) => item . user !== userId ) ;
346
+ if ( newUsers . length == 0 ) return ;
347
+ newUsers = props . localUser . value ;
348
+ let updatedUsers = [ ...userIds , newUsers ] ;
349
+ console . log ( "updatedUsers" , updatedUsers ) ;
350
+ dispatch (
351
+ changeChildAction ( "participants" , getData ( updatedUsers ) . data , false )
352
+ ) ;
353
+ }
354
+ } , [ props . localUser . value ] ) ;
355
+
334
356
useEffect ( ( ) => {
335
357
if ( rtmChannelResponse ) {
336
358
rtmClient . on ( "MessageFromPeer" , function ( message , peerId ) {
@@ -526,7 +548,6 @@ MTComp = withMethodExposing(MTComp, [
526
548
user : userId + "" ,
527
549
audiostatus : value ,
528
550
} ) ;
529
- console . log ( localUserData ) ;
530
551
await turnOnMicrophone ( value ) ;
531
552
comp . children . audioControl . change ( value ) ;
532
553
} ,
@@ -583,13 +604,12 @@ MTComp = withMethodExposing(MTComp, [
583
604
584
605
let message : any = {
585
606
time : Date . now ( ) ,
586
- from : userId ,
607
+ from : comp . children . localUser . getView ( ) . value ,
587
608
} ;
588
609
message [ "data" ] = otherData ;
589
610
590
611
if ( toUsers . length > 0 && toUsers [ 0 ] !== undefined ) {
591
612
let peers = toUsers ?. map ( ( u : any ) => u . user ) ;
592
- console . log ( "peers" , peers ) ;
593
613
peers . forEach ( ( p : any ) => {
594
614
sendPeerMessageRtm ( message , String ( p ) ) ;
595
615
} ) ;
@@ -598,6 +618,29 @@ MTComp = withMethodExposing(MTComp, [
598
618
}
599
619
} ,
600
620
} ,
621
+ {
622
+ method : {
623
+ name : "setMeetingName" ,
624
+ description : trans ( "meeting.meetingName" ) ,
625
+ params : [ ] ,
626
+ } ,
627
+ execute : async ( comp , values ) => {
628
+ let meetingName : any = values [ 0 ] ;
629
+ comp . children . meetingName . change ( meetingName ) ;
630
+ } ,
631
+ } ,
632
+ {
633
+ method : {
634
+ name : "setUserName" ,
635
+ description : trans ( "meeting.meetingName" ) ,
636
+ params : [ ] ,
637
+ } ,
638
+ execute : async ( comp , values ) => {
639
+ let userName : any = values [ 0 ] ;
640
+ let userLocal = comp . children . localUser . getView ( ) . value ;
641
+ comp . children . localUser . change ( { ...userLocal , userName : userName } ) ;
642
+ } ,
643
+ } ,
601
644
{
602
645
method : {
603
646
name : "endMeeting" ,
0 commit comments