Skip to content

Commit

Permalink
updating calling sample
Browse files Browse the repository at this point in the history
  • Loading branch information
alkwa-msft committed Nov 10, 2023
1 parent 1d0c25d commit bec808c
Show file tree
Hide file tree
Showing 28 changed files with 168 additions and 146 deletions.
198 changes: 99 additions & 99 deletions Calling/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Calling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
},
"dependencies": {
"@azure/abort-controller": "^1.1.0",
"@azure/communication-calling": "^1.16.3",
"@azure/communication-calling": "1.18.1",
"@azure/communication-common": "^2.2.1",
"@azure/communication-identity": "^1.2.0",
"@azure/communication-react": "1.9.0",
"@azure/communication-react": "1.10.0",
"@azure/logger": "1.0.4",
"@babel/preset-react": "^7.12.7",
"@fluentui/react": "~8.110.4",
Expand Down
24 changes: 10 additions & 14 deletions Calling/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { CommunicationUserIdentifier } from '@azure/communication-common';

Check failure on line 4 in Calling/src/app/App.tsx

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand All @@ -8,6 +8,9 @@ import { initializeIcons, Spinner } from '@fluentui/react';
import { CallAdapterLocator } from '@azure/communication-react';
import React, { useEffect, useState } from 'react';
import {
buildTime,
callingSDKVersion,
communicationReactSDKVersion,
createGroupId,
fetchTokenResponse,
getGroupIdFromUrl,
Expand All @@ -19,14 +22,16 @@ import {
} from './utils/AppUtils';

import { useIsMobile } from './utils/useIsMobile';
import { useSecondaryInstanceCheck } from './utils/useSecondaryInstanceCheck';
import { CallError } from './views/CallError';
import { CallScreen } from './views/CallScreen';
import { HomeScreen } from './views/HomeScreen';
import { PageOpenInAnotherTab } from './views/PageOpenInAnotherTab';
import { UnsupportedBrowserPage } from './views/UnsupportedBrowserPage';

setLogLevel('verbose');
setLogLevel('error');

console.log(
`ACS sample calling app. Last Updated ${buildTime} Using @azure/communication-calling:${callingSDKVersion} and @azure/communication-react:${communicationReactSDKVersion}`
);

initializeIcons();

Expand Down Expand Up @@ -60,18 +65,13 @@ const App = (): JSX.Element => {

const isMobileSession = useIsMobile();
const isLandscapeSession = isLandscape();
const isAppAlreadyRunningInAnotherTab = useSecondaryInstanceCheck();

useEffect(() => {
if (isMobileSession && isLandscapeSession) {
console.log('ACS Calling sample: Mobile landscape view is experimental behavior');
}
}, [isMobileSession, isLandscapeSession]);

if (isMobileSession && isAppAlreadyRunningInAnotherTab) {
return <PageOpenInAnotherTab />;
}

const supportedBrowser = !isOnIphoneAndNotSafari();
if (!supportedBrowser) {
return <UnsupportedBrowserPage />;
Expand Down Expand Up @@ -124,11 +124,7 @@ const App = (): JSX.Element => {
document.title = `credentials - ${WEB_APP_TITLE}`;
return <Spinner label={'Getting user credentials from server'} ariaLive="assertive" labelPosition="top" />;
}
return (
<React.StrictMode>
<CallScreen token={token} userId={userId} displayName={displayName} callLocator={callLocator} />
</React.StrictMode>
);
return <CallScreen token={token} userId={userId} displayName={displayName} callLocator={callLocator} />;
}
default:
document.title = `error - ${WEB_APP_TITLE}`;
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/styles/CallScreen.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { IStackItemStyles, IStackStyles } from '@fluentui/react';

Check failure on line 4 in Calling/src/app/styles/CallScreen.styles.ts

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/styles/DisplayNameField.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { mergeStyles } from '@fluentui/react';

Check failure on line 4 in Calling/src/app/styles/DisplayNameField.styles.ts

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/styles/EndCall.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { IButtonStyles, IStackTokens, mergeStyles } from '@fluentui/react';

Check failure on line 4 in Calling/src/app/styles/EndCall.styles.ts

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/styles/Footer.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { IButtonStyles, IStackStyles, IStackTokens, ITextFieldStyles, mergeStyles } from '@fluentui/react';

Check failure on line 4 in Calling/src/app/styles/Footer.styles.ts

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/styles/HomeScreen.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { IStackTokens, mergeStyles } from '@fluentui/react';

Check failure on line 4 in Calling/src/app/styles/HomeScreen.styles.ts

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/styles/StartCallButton.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { mergeStyles } from '@fluentui/react';

Check failure on line 4 in Calling/src/app/styles/StartCallButton.styles.ts

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/theming/SwitchableFluentThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import React, { useState, useMemo, createContext, useContext } from 'react';

Check failure on line 4 in Calling/src/app/theming/SwitchableFluentThemeProvider.tsx

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header
import { FluentThemeProvider, lightTheme, darkTheme } from '@azure/communication-react';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/theming/ThemeSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import React from 'react';

Check failure on line 4 in Calling/src/app/theming/ThemeSelector.tsx

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header
import { ChoiceGroup, IChoiceGroupOption, concatStyleSets } from '@fluentui/react';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/utils/AppUtils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { createRandomDisplayName, getGroupIdFromUrl } from './AppUtils';

Check failure on line 4 in Calling/src/app/utils/AppUtils.test.ts

View workflow job for this annotation

GitHub Actions / Run clean code tests on frontend

incorrect header

Expand Down
11 changes: 10 additions & 1 deletion Calling/src/app/utils/AppUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { GroupLocator, TeamsMeetingLinkLocator } from '@azure/communication-calling';

Expand Down Expand Up @@ -65,3 +65,12 @@ export const navigateToHomePage = (): void => {
};

export const WEB_APP_TITLE = document.title;

declare let __BUILDTIME__: string; // Injected by webpack
export const buildTime = __BUILDTIME__;

declare let __CALLINGVERSION__: string; // Injected by webpack
export const callingSDKVersion = __CALLINGVERSION__;

declare let __COMMUNICATIONREACTVERSION__: string; //Injected by webpack
export const communicationReactSDKVersion = __COMMUNICATIONREACTVERSION__;
2 changes: 1 addition & 1 deletion Calling/src/app/utils/credential.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { AzureCommunicationTokenCredential, CommunicationTokenRefreshOptions } from '@azure/communication-common';
import { AbortSignalLike } from '@azure/abort-controller';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/utils/localStorage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

export const localStorageAvailable = typeof Storage !== 'undefined';

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/utils/useSecondaryInstanceCheck.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { useEffect, useState } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/CallCompositeContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { CommonCallAdapter, CallComposite } from '@azure/communication-react';

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/CallError.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import React from 'react';
import { DefaultButton, PrimaryButton, Stack, Text } from '@fluentui/react';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/CallScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { AzureCommunicationTokenCredential, CommunicationUserIdentifier } from '@azure/communication-common';

Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/DisplayNameField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { TextField } from '@fluentui/react';
import React, { useState } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { Icon, PrimaryButton, Separator, Stack, TextField } from '@fluentui/react';
import {
Expand Down
16 changes: 15 additions & 1 deletion Calling/src/app/views/HomeScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import React, { useState } from 'react';
import { Stack, PrimaryButton, Image, ChoiceGroup, IChoiceGroupOption, Text, TextField } from '@fluentui/react';
Expand Down Expand Up @@ -95,6 +95,20 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
onChange={(_, newValue) => newValue && setCallLocator({ meetingLink: newValue })}
/>
)}

{}

{}

{}

{}

{}

{}

{}
</Stack>
{showDisplayNameField && <DisplayNameField defaultName={displayName} setName={setDisplayName} />}
<PrimaryButton
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/NoticePage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import React, { ReactNode } from 'react';
import { IStyle, IStackTokens, mergeStyles, Stack, Text } from '@fluentui/react';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/PageOpenInAnotherTab.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { Link } from '@fluentui/react';
import React from 'react';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/app/views/UnsupportedBrowserPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import { Link } from '@fluentui/react';
import React from 'react';
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/assets/assets.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

declare module '*.svg' {
const content: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
Expand Down
2 changes: 1 addition & 1 deletion Calling/src/index.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) Microsoft Corporation. */
/* Licensed under the MIT license. */
/* Licensed under the MIT License. */

body,
html,
Expand Down
17 changes: 10 additions & 7 deletions Calling/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// Licensed under the MIT License.

import React from 'react';
import { createRoot } from 'react-dom/client';
Expand All @@ -14,10 +14,13 @@ if (!domNode) {
}

createRoot(domNode).render(
<SwitchableFluentThemeProvider scopeId="SampleCallingApp">
<div className="wrapper">
<App />
<ShakeToSendLogs />
</div>
</SwitchableFluentThemeProvider>
<React.StrictMode>
<SwitchableFluentThemeProvider scopeId="SampleCallingApp">
<div className="wrapper">
<App />
<ShakeToSendLogs />
</div>
</SwitchableFluentThemeProvider>
</React.StrictMode>
);
export {}; /*The above line is generated by conditional compilation, when no export detected after CC.*/

0 comments on commit bec808c

Please sign in to comment.