Help Center/ Meeting/ Client SDK Reference/ Electron SDK/ Typical Scenarios/ Scenario 11: Customizing the Invite Button in a Meeting
Updated on 2023-03-23 GMT+08:00

Scenario 11: Customizing the Invite Button in a Meeting

Description

In most scenarios where the SDK is used for secondary development, third-party applications do not use the corporate directory provided by Huawei Cloud Meeting. Therefore, the page for inviting participants only provides a button and does not provide the complete function of inviting participants. You must implement the function by yourself.

Service Process

When using the SDK to implement the participant invitation function, call the config API, implement the API callback function onConfigResult and implement the subscribed-to message notification onClickInjectBtnNotify after the Invite button is clicked in a meeting.

  1. Call an API.

    1. Assemble the character string containing the configuration information and the API callback function onConfigResult.
    2. Call the config API. The data in the preceding step is used as input parameters.

  2. Implement the callback function.

    Implement the onConfigResult function.

  3. Implement the notification function.

    After the Invite button is clicked, implement the subscribed-to message notification onClickInjectBtnNotify.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* Configure the Invite button.
*/
async setInvite(){
    let param = {
        "frame": {
            "confMenu": {
                "toolBar": {
                    "button": [{
                        "buttonId": "invite",
                        "showAsAction": "ifRoom",
                        "isCustomizedClick": true
                    }]
                }
            }
        }
    }
    const apiService = new ApiService();
    let setResult = await apiService.config(JSON.stringify(param));
    if(setResult.ret != 0){
        window.electron.ipcRenderer.send("show-error-alert", "config error = " + setResult.ret);
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
/**
* Definition of config API in ApiService
*/
async config(uiConfig) {
  return new Promise((resolve) => {
    let resultCallback = (ret, reason) => {
      console.log("config, out data = ", { ret, reason });
      resolve({ ret, reason });
    };
    console.log("config, in param = ", uiConfig);
    this.uisdkService.getUIConfigApi().config(uiConfig, resultCallback);
  });
}

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* Subscribe to the button click notification onClickInjectBtnNotify.
*/
uisdkService.getUIConfigApi().setOnClickInjectBtnNotifyCB(NotifyService.handleOnClickInjectBtnNotify);

/**
* Definition of handleOnClickInjectBtnNotify in NotifyService
*/
static handleOnClickInjectBtnNotify(injectBtnInfo) {
    console.log('OnClickInjectBtnNotify', ', injectBtnInfo = ', injectBtnInfo);
    switch (injectBtnInfo.injectBtn) {
        // Send a notification after the Invite button is clicked.
        case ClickInjectBtn.HWM_CLICK_INJECT_BTN_INVITE:
           // Display the screen for adding participants.
            window.location.hash = "#/confCtrlPage/addAttendee";
            window.electron.ipcRenderer.send('show-add-attendee-window');
            break;
        default:
            break;
    }
}