Skip to content

Commit 1bc9915

Browse files
Merge pull request #285813 from garchiro7/button-injection
Button injection
2 parents eca1545 + d329fd6 commit 1bc9915

File tree

7 files changed

+258
-7
lines changed

7 files changed

+258
-7
lines changed
29.2 KB
Loading
18.3 KB
Loading

articles/communication-services/concepts/ui-library/includes/mobile-ui-use-cases.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Use the `CallComposite` and the `ChatComposite` in the Azure Communication Servi
1212

1313
You can use the call composite in Communication Services to create these use cases:
1414

15-
| Area | Use cases |
16-
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
17-
| Call types | Join a Microsoft Teams meeting |
18-
| | Join a Microsoft Teams meeting using Meeting ID and Passcode |
19-
| | Join a call by using a group ID |
20-
| | Join a call by using a room ID |
21-
| | Make and Receive 1:1 Calls |
15+
| Area | Use cases |
16+
| -------------------------------------------------------------------- | --------------------------------------------------------------- |
17+
| Call types | Join a Microsoft Teams meeting |
18+
| | Join a Microsoft Teams meeting using Meeting ID and Passcode |
19+
| | Join a call by using a group ID |
20+
| | Join a call by using a room ID |
21+
| | Make and Receive 1:1 Calls |
2222
| [Teams interoperability](../../teams-interop.md) | Join the call lobby |
2323
| | Display a transcription and recording alert banner |
2424
| | Admit/Reject lobby participants |
@@ -41,6 +41,8 @@ You can use the call composite in Communication Services to create these use cas
4141
| | End a call |
4242
| | Hold and resume a call after audio interruption |
4343
| | CallKit and TelecomManager Support |
44+
| Customize the experience | Button bar customization |
45+
4446

4547
### Teams interoperability
4648

@@ -94,6 +96,37 @@ You can use the UI Library call composite for iOS and Android to create a custom
9496
| -------------------------------------------------------- | --------------------------------------------------------------- |
9597
| :::image type="content" source="../../media/mobile-ui/android-color.png" alt-text="Screenshot that shows Android theming for a caller experience."::: | :::image type="content" source="../../media/mobile-ui/ios-dark.png" alt-text="Screenshot that shows iOS theming for a caller experience."::: |
9698

99+
### Button bar customization
100+
101+
The functionality allows developers to add new actions into the contextual menu or remove current buttons in the button bar, providing the flexibility to introduce custom actions and tailor the user interface according to specific application needs.
102+
103+
- Add Custom Buttons: Developers can introduce new buttons into the contextual button bar to trigger custom actions.
104+
- Remove Existing Buttons: Unnecessary default buttons can be removed to streamline the interface: camera, microphone o audio selection.
105+
106+
Consider the following constraints during the implementation of this feature:
107+
108+
- Icons and Labels: Icons are added only for new actions. The button bar icons keep the predefined icon, labels should be concise to fit the menu dimension.
109+
- Accessibility Considerations: Developers should ensure that all custom buttons are accessible, including appropriate labeling for screen readers.
110+
111+
|Remove buttons | Add custom actions|
112+
|------------- | ------------------|
113+
| :::image type="content" source="media/ui-library-remove-button.png" alt-text="Screenshot that demonstrates the remove button on the bottom bar."::: | :::image type="content" source="media/ui-library-add-action-button.png" alt-text="Screenshot that demonstrates add custom action into the contextual menu."::: |
114+
115+
#### Use cases
116+
117+
- Custom In-Call Actions: A business application can add a custom "Report Issue" button, allowing users to directly report technical issues during a call.
118+
- Branding and User Experience: An enterprise app can remove buttons that are irrelevant to its use case and add branded buttons that enhance the user experience.
119+
120+
To ensure a consistent call experience, , we recommend that you integrate Fluent UI icons into your project; available at [Fluent UI GitHub repository](https://github.com/microsoft/fluentui-system-icons/). By doing so, your custom icons will match the design of the Call Composite, creating a cohesive and professional appearance.
121+
122+
#### Best practices
123+
124+
- Minimalism: Avoid overcrowding the contextual menu bar. Only add buttons that are essential for the user experience.
125+
- User Testing: Conduct user testing to ensure the customizations meets user needs and don't confuse or overwhelm them.
126+
- Add a Feedback Mechanism: If adding buttons for actions like "Report Issue," ensure there's a robust backend system to handle the feedback collected, you can reuse the [mechanism that UI Library provides by default](../../../tutorials/collecting-user-feedback/collecting-user-feedback.md).
127+
128+
For more information, see [How to customize the button bar](../../../how-tos/ui-library-sdk/button-injection.md).
129+
97130
### Screen size
98131

99132
You can adapt the Azure Communication Services call composite to adapt to screen sizes from 5 inches to tablet size. Use split mode and tablet mode in the call composite to get the dynamic participants' roster layout, provide clarity on the view, and focus on the conversation.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Customize the actions from the button bar in the UI Library
3+
titleSuffix: An Azure Communication Services how-to guide
4+
description: Customize the actions from the button bar in the Azure Communication Services UI Library.
5+
author: garchiro7
6+
7+
ms.author: jorgegarc
8+
ms.service: azure-communication-services
9+
ms.subservice: calling
10+
ms.topic: how-to
11+
ms.date: 08/01/2024
12+
ms.custom: template-how-to
13+
zone_pivot_groups: acs-plat-ios-android
14+
15+
#Customer intent: As a developer, I want to customize the button bar actions in the UI Library.
16+
---
17+
18+
# Customize the button bar
19+
20+
[!INCLUDE [Public Preview Notice](../../includes/public-preview-include.md)]
21+
22+
To implement custom actions or modify the current button layout, you can interact with the Native UI Library's API. This API involves defining custom button configurations, specifying actions, and managing the button bar's current actions. The API provides methods for adding custom actions, and removing existing buttons, all of which are accessible via straightforward function calls.
23+
24+
This functionality provides a high degree of customization, and ensures that the user interface remains cohesive and consistent with the application's overall design.
25+
26+
## Prerequisites
27+
28+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
29+
- A deployed Communication Services resource. [Create a Communication Services resource](../../quickstarts/create-communication-resource.md).
30+
- A user access token to enable the call client. [Get a user access token](../../quickstarts/access-tokens.md).
31+
- Optional: Completion of the [quickstart for getting started with the UI Library composites](../../quickstarts/ui-library/get-started-composites.md).
32+
33+
## Set up the feature
34+
35+
::: zone pivot="platform-android"
36+
[!INCLUDE [Customize the actions from the button bar in the Android UI Library](./includes/button-injection/android.md)]
37+
::: zone-end
38+
39+
::: zone pivot="platform-ios"
40+
[!INCLUDE [DCustomize the actions from the button bar in the iOS UI Library](./includes/button-injection/ios.md)]
41+
::: zone-end
42+
43+
## Next steps
44+
45+
- [Learn more about the UI Library](../../concepts/ui-library/ui-library-overview.md)
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
description: Learn how to customize the actions from the button bar in the Android UI Library
3+
author: garchiro7
4+
5+
ms.author: jorgegarc
6+
ms.date: 08/01/2024
7+
ms.topic: include
8+
ms.service: azure-communication-services
9+
---
10+
11+
## Remove buttons
12+
13+
`CallCompositeCallScreenControlBarOptions`, allow the flexibility to customize the button bar by removing specific buttons such as camera, microphone, and audio controls. This API allows you to tailor the user interface according to their specific application requirements and user experience design. Just set the visibility to `false` to hide, the default behavior is for `CallCompositeButtonOptions` object.
14+
15+
#### [Kotlin](#tab/kotlin)
16+
17+
```kotlin
18+
val controlBarOptions = CallCompositeCallScreenControlBarOptions()
19+
20+
val cameraButton = CallCompositeButtonOptions()
21+
.setVisible(false)
22+
23+
controlBarOptions.setCameraButton(cameraButton)
24+
25+
val callScreenOptions = CallCompositeCallScreenOptions()
26+
.setControlBarOptions(controlBarOptions)
27+
28+
val localOptions = CallCompositeLocalOptions()
29+
.setCallScreenOptions(callScreenOptions)
30+
31+
val callComposite = CallCompositeBuilder()
32+
.build()
33+
34+
callComposite.launch(context, locator, localOptions)
35+
```
36+
37+
#### [Java](#tab/java)
38+
```java
39+
CallCompositeCallScreenControlBarOptions controlBarOptions = new CallCompositeCallScreenControlBarOptions();
40+
41+
CallCompositeButtonOptions cameraButton = new CallCompositeButtonOptions()
42+
.setVisible(false);
43+
44+
controlBarOptions.setCameraButton(cameraButton);
45+
46+
CallCompositeCallScreenOptions callScreenOptions = new CallCompositeCallScreenOptions()
47+
.setControlBarOptions(controlBarOptions);
48+
49+
CallCompositeLocalOptions localOptions = new CallCompositeLocalOptions()
50+
.setCallScreenOptions(callScreenOptions);
51+
52+
CallComposite callComposite = new CallCompositeBuilder()
53+
.build();
54+
55+
callComposite.launch(context, locator, localOptions);
56+
```
57+
58+
-----
59+
60+
## Add custom actions
61+
62+
`Call composite` is using Fluent UI icons. You can download the icons directly from [the Fluent UI GitHub repository](https://github.com/microsoft/fluentui-system-icons/) and incorporate them into your project as needed. This approach guarantees visual consistency across all user interface elements, enhancing the overall user experience.
63+
64+
#### [Kotlin](#tab/kotlin)
65+
66+
```kotlin
67+
val controlBarOptions = CallCompositeCallScreenControlBarOptions()
68+
69+
controlBarOptions.setCustomButtons(
70+
listOf(
71+
CallCompositeCustomButtonOptions(
72+
R.drawable.my_button_image,
73+
"My button",
74+
fun(it: CallCompositeCustomButtonClickEvent) {
75+
// Process my button onClick
76+
},
77+
)
78+
)
79+
)
80+
81+
val callScreenOptions = CallCompositeCallScreenOptions()
82+
.setControlBarOptions(controlBarOptions)
83+
84+
val localOptions = CallCompositeLocalOptions()
85+
.setCallScreenOptions(callScreenOptions)
86+
87+
val callComposite = CallCompositeBuilder()
88+
.build()
89+
90+
callComposite.launch(context, locator, localOptions)
91+
```
92+
93+
#### [Java](#tab/java)
94+
```java
95+
CallCompositeCallScreenControlBarOptions controlBarOptions = new CallCompositeCallScreenControlBarOptions();
96+
97+
List<CallCompositeCustomButtonOptions> customButtons = new ArrayList<>();
98+
customButtons.add(
99+
new CallCompositeCustomButtonOptions(
100+
R.drawable.my_button_image,
101+
"My button",
102+
eventArgs -> {
103+
// process my button onClick
104+
}
105+
)
106+
);
107+
108+
controlBarOptions.setCustomButtons(customButtons);
109+
110+
CallCompositeCallScreenOptions callScreenOptions = new CallCompositeCallScreenOptions()
111+
.setControlBarOptions(controlBarOptions);
112+
113+
CallCompositeLocalOptions localOptions = new CallCompositeLocalOptions()
114+
.setCallScreenOptions(callScreenOptions);
115+
116+
CallComposite callComposite = new CallCompositeBuilder()
117+
.build();
118+
119+
callComposite.launch(context, locator, localOptions);
120+
```
121+
122+
-----
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
description: Learn how to customize the actions from the button bar in the iOS UI Library
3+
author: garchiro7
4+
5+
ms.author: jorgegarc
6+
ms.date: 08/01/2024
7+
ms.topic: include
8+
ms.service: azure-communication-services
9+
---
10+
11+
12+
## Remove buttons
13+
14+
`CallScreenControlBarOptions`, allow the flexibility to customize the button bar by removing specific buttons such as camera, microphone, and audio controls. This API allows you to tailor the user interface according to their specific application requirements and user experience design. Just set the visibility to `false` to hide, the default behavior is for `ButtonOptions` object.
15+
16+
```swift
17+
let cameraButton = ButtonOptions(visible: false)
18+
19+
let callScreenControlBarOptions = CallScreenControlBarOptions(
20+
cameraButton: cameraButton
21+
)
22+
23+
let callScreenOptions = CallScreenOptions(controlBarOptions: callScreenControlBarOptions)
24+
let localOptions = LocalOptions(callScreenOptions: callScreenOptions)
25+
26+
let callComposite = CallComposite(credential: credential)
27+
callComposite.launch(locator: .roomCall(roomId: "..."), localOptions: localOptions)
28+
```
29+
30+
## Add custom actions
31+
32+
`Call composite` is using Fluent UI icons. You can download the icons directly from [the Fluent UI GitHub repository](https://github.com/microsoft/fluentui-system-icons/) and incorporate them into your project as needed. This approach guarantees visual consistency across all user interface elements, enhancing the overall user experience.
33+
34+
```swift
35+
let customButton = CustomButtonOptions(image: UIImage(named: "...")!,
36+
title: "My button") {_ in
37+
// Process my button onClick
38+
}
39+
40+
let callScreenControlBarOptions = CallScreenControlBarOptions(
41+
customButtons: [customButton]
42+
)
43+
44+
let callScreenOptions = CallScreenOptions(controlBarOptions: callScreenControlBarOptions)
45+
let localOptions = LocalOptions(callScreenOptions: callScreenOptions)
46+
47+
let callComposite = CallComposite(credential: credential)
48+
callComposite.launch(locator: .roomCall(roomId: "..."), localOptions: localOptions)
49+
```

articles/communication-services/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ items:
441441
href: how-tos/ui-library-sdk/closed-captions.md
442442
- name: Configure theming
443443
href: how-tos/ui-library-sdk/theming.md
444+
- name: Customize the button bar
445+
href: how-tos/ui-library-sdk/button-injection.md
444446
- name: Disable end call confirmation
445447
href: how-tos/ui-library-sdk/leave-call-confirmation.md
446448
- name: Enable audio only mode

0 commit comments

Comments
 (0)