Skip to content

Commit 7b0e297

Browse files
carocao-msftJamesBurnsideprprabhu-msdmceachernmsft
authored
Add allow camera and microphone access drawer to call composite mobile config screen (#2434)
* add drawer to mobile * Change files * add drawer to mobile * Change files * Require webpack 5 in our lib. Add minimum webpack and typescript versions to storybook. Update `html-to-parser` version (#2428) Co-authored-by: Prathmesh Prabhu <82062616+prprabhu-ms@users.noreply.github.com> * Fix `dtmfDialpadPlaceHolderText` spelling and restrict it to beta builds (#2439) * Add troubleshooting guide error bar to call composite config screen (#2433) * add error bar * Change files * pr fix * add drawer to mobile * Add troubleshooting guide error bar to call composite config screen (#2433) * add error bar * Change files * pr fix * add drawer to mobile * Add troubleshooting guide error bar to call composite config screen (#2433) * add error bar * Change files * pr fix * add drawer to mobile * pr fix * pr change * pr change * pr change * pr fix Co-authored-by: James Burnside <2684369+JamesBurnside@users.noreply.github.com> Co-authored-by: Prathmesh Prabhu <82062616+prprabhu-ms@users.noreply.github.com> Co-authored-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com>
1 parent 7798a6c commit 7b0e297

20 files changed

Lines changed: 142 additions & 50 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "change device permission component string prop to optional",
4+
"packageName": "@internal/react-components",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Add device permission drawer to calling mobile config screen",
4+
"packageName": "@internal/react-composites",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/communication-react/review/beta/communication-react.api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,12 +1927,13 @@ export const DomainPermissions: (props: DomainPermissionsProps) => JSX.Element;
19271927
export interface DomainPermissionsProps {
19281928
appName: string;
19291929
onAllowAccessClick?: () => void;
1930-
onTroubleshootingClick: () => void;
1931-
strings: DomainPermissionsStrings;
1930+
onTroubleshootingClick?: () => void;
1931+
strings?: DomainPermissionsStrings;
19321932
}
19331933

19341934
// @beta
19351935
export interface DomainPermissionsStrings {
1936+
ariaLabel: string;
19361937
linkText: string;
19371938
primaryButtonText: string;
19381939
primaryText: string;

packages/react-components/review/beta/react-components.api.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,13 @@ export const DomainPermissions: (props: DomainPermissionsProps) => JSX.Element;
586586
export interface DomainPermissionsProps {
587587
appName: string;
588588
onAllowAccessClick?: () => void;
589-
onTroubleshootingClick: () => void;
590-
strings: DomainPermissionsStrings;
589+
onTroubleshootingClick?: () => void;
590+
strings?: DomainPermissionsStrings;
591591
}
592592

593593
// @beta
594594
export interface DomainPermissionsStrings {
595+
ariaLabel: string;
595596
linkText: string;
596597
primaryButtonText: string;
597598
primaryText: string;

packages/react-components/src/components/DomainPermissions.tsx

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ export interface DomainPermissionsProps {
3232
/**
3333
* Action to be taken by the more help link. Possible to send to external page or show other modal.
3434
*/
35-
onTroubleshootingClick: () => void;
35+
onTroubleshootingClick?: () => void;
3636
/**
3737
* Action to be taken by the Allow Access button.
3838
*/
3939
onAllowAccessClick?: () => void;
4040
/**
4141
* Localization strings for DomainPermissions component.
4242
*/
43-
strings: DomainPermissionsStrings;
43+
strings?: DomainPermissionsStrings;
4444
}
4545

4646
/**
@@ -64,14 +64,18 @@ export interface DomainPermissionsStrings {
6464
* Primary button text string.
6565
*/
6666
primaryButtonText: string;
67+
/**
68+
* Aira label describing the content of the container
69+
*/
70+
ariaLabel: string;
6771
}
6872

6973
/* @conditional-compile-remove(call-readiness) */
7074
const DomainPermissionsContainer = (props: DomainPermissionsProps): JSX.Element => {
7175
const { appName, onTroubleshootingClick, onAllowAccessClick, strings } = props;
7276
const theme = useTheme();
7377
return (
74-
<Stack style={{ padding: '2rem', maxWidth: '25.375rem' }}>
78+
<Stack style={{ padding: '2rem', maxWidth: '25.375rem' }} aria-label={strings?.ariaLabel}>
7579
<Stack horizontal style={{ paddingBottom: '1rem' }} horizontalAlign={'space-between'}>
7680
<Stack styles={iconContainerStyles} horizontalAlign={'center'}>
7781
<Icon styles={iconPrimaryStyles} iconName={'DomainPermissionCamera'}></Icon>
@@ -84,14 +88,21 @@ const DomainPermissionsContainer = (props: DomainPermissionsProps): JSX.Element
8488
</Stack>
8589
</Stack>
8690
<Stack styles={textContainerStyles}>
87-
<Text styles={primaryTextStyles}>{_formatString(strings.primaryText, { appName: appName })}</Text>
88-
<Text styles={secondaryTextStyles}>{strings.secondaryText}</Text>
89-
{onAllowAccessClick && (
90-
<PrimaryButton styles={primaryButtonStyles} text={strings.primaryButtonText} onClick={onAllowAccessClick} />
91+
{strings && isValidString(strings?.primaryText) && (
92+
<Text styles={primaryTextStyles}>{_formatString(strings.primaryText, { appName: appName })}</Text>
93+
)}
94+
{strings && isValidString(strings?.secondaryText) && (
95+
<Text styles={secondaryTextStyles}>{strings?.secondaryText}</Text>
96+
)}
97+
98+
{onAllowAccessClick && isValidString(strings?.primaryButtonText) && (
99+
<PrimaryButton styles={primaryButtonStyles} text={strings?.primaryButtonText} onClick={onAllowAccessClick} />
100+
)}
101+
{onTroubleshootingClick && isValidString(strings?.linkText) && (
102+
<Link styles={linkTextStyles} onClick={onTroubleshootingClick}>
103+
{strings?.linkText}
104+
</Link>
91105
)}
92-
<Link styles={linkTextStyles} onClick={onTroubleshootingClick}>
93-
{strings.linkText}
94-
</Link>
95106
</Stack>
96107
</Stack>
97108
);
@@ -110,3 +121,8 @@ export const DomainPermissions = (props: DomainPermissionsProps): JSX.Element =>
110121
return <DomainPermissionsContainer {...props} strings={props.strings ? props.strings : locale} />;
111122
return <></>;
112123
};
124+
125+
/* @conditional-compile-remove(call-readiness) */
126+
const isValidString = (string: string | undefined): boolean => {
127+
return !!string && string.length > 0;
128+
};

packages/react-components/src/localization/locales/en-US/strings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@
188188
"primaryText": "Allow {appName} to use your camera and microphone",
189189
"secondaryText": "This is so participants can see and hear you.",
190190
"linkText": "Need help? Get troubleshooting help",
191-
"primaryButtonText": "Allow Access"
191+
"primaryButtonText": "Allow Access",
192+
"ariaLabel": "Allow camera and microphone access"
192193
},
193194
"UnsupportedBrowser": {
194195
"primaryText": "Browser not supported",

packages/react-composites/src/composites/CallComposite/CallComposite.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ const MainScreen = (props: MainScreenProps): JSX.Element => {
228228
onPermissionsTroubleshootingClick={props.options?.onPermissionsTroubleshootingClick}
229229
/* @conditional-compile-remove(call-readiness) */
230230
onNetworkingTroubleShootingClick={props.options?.onNetworkingTroubleShootingClick}
231+
/* @conditional-compile-remove(call-readiness) */
232+
callReadinessOptedIn={props.options?.callReadinessOptedIn}
231233
/>
232234
);
233235
break;

packages/react-composites/src/composites/CallComposite/components/CallPane.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export const CallPane = (props: {
147147
</CallAdapterProvider>
148148
)}
149149
{drawerMenuItems.length > 0 && (
150-
<Stack styles={drawerContainerStyles}>
150+
<Stack styles={drawerContainerStyles()}>
151151
<_DrawerMenu onLightDismiss={() => setDrawerMenuItems([])} items={drawerMenuItems} />
152152
</Stack>
153153
)}

packages/react-composites/src/composites/CallComposite/components/ConfigurationpageCameraDropdown.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface ConfigurationpageCameraDropdownProps {
2222
cameraGrantedDropdown: JSX.Element;
2323
cameraPermissionGranted: boolean;
2424
dropdownProps?: Record<string, never> & Partial<CallingHandlers>;
25+
callReadinessOptedIn?: boolean;
2526
}
2627

2728
/**
@@ -50,7 +51,9 @@ export const ConfigurationpageCameraDropdown = (props: ConfigurationpageCameraDr
5051
);
5152

5253
/* @conditional-compile-remove(call-readiness) */
53-
return <>{props.cameraPermissionGranted ? props.cameraGrantedDropdown : cameraBlockedDropdown}</>;
54+
if (props.callReadinessOptedIn) {
55+
return <>{props.cameraPermissionGranted ? props.cameraGrantedDropdown : cameraBlockedDropdown}</>;
56+
}
5457

5558
return props.cameraGrantedDropdown;
5659
};

packages/react-composites/src/composites/CallComposite/components/ConfigurationpageErrorBar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface ConfigurationpageErrorBarProps {
3131
camera: PermissionState;
3232
microphone: PermissionState;
3333
};
34+
callReadinessOptedIn?: boolean;
3435
}
3536

3637
/**
@@ -46,7 +47,9 @@ export const ConfigurationpageErrorBar = (props: ConfigurationpageErrorBarProps)
4647
/* @conditional-compile-remove(call-readiness) */
4748
onNetworkingTroubleShootingClick,
4849
/* @conditional-compile-remove(call-readiness) */
49-
permissionsState
50+
permissionsState,
51+
/* @conditional-compile-remove(call-readiness) */
52+
callReadinessOptedIn = false
5053
} = props;
5154

5255
/* @conditional-compile-remove(call-readiness) */
@@ -57,7 +60,7 @@ export const ConfigurationpageErrorBar = (props: ConfigurationpageErrorBarProps)
5760
};
5861

5962
/* @conditional-compile-remove(call-readiness) */
60-
if (showTroubleShootingErrorBar) {
63+
if (showTroubleShootingErrorBar && callReadinessOptedIn) {
6164
return (
6265
<_TroubleshootingGuideErrorBar
6366
troubleshootingGuideStrings={permissionTroubleshootingGuideStrings}

0 commit comments

Comments
 (0)