Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add visionOS client type #2670

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Add visionOS client type support for Teams SDK. This change will enable app developers to find out if app is running on visionOS",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
5 changes: 3 additions & 2 deletions packages/teams-js/src/internal/internalAPIs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function isCurrentSDKVersionAtLeast(requiredVersion: string = defaultSDKV

/**
* @hidden
* Helper function to identify if host client is either android, ios, or ipados
* Helper function to identify if host client is either android, ios, ipados or visionOS
wyAbhishek marked this conversation as resolved.
Show resolved Hide resolved
*
* @internal
* Limited to Microsoft-internal use
Expand All @@ -100,7 +100,8 @@ export function isHostClientMobile(): boolean {
return (
GlobalVars.hostClientType == HostClientType.android ||
GlobalVars.hostClientType == HostClientType.ios ||
GlobalVars.hostClientType == HostClientType.ipados
GlobalVars.hostClientType == HostClientType.ipados ||
GlobalVars.hostClientType == HostClientType.visionOS
);
}

Expand Down
2 changes: 2 additions & 0 deletions packages/teams-js/src/public/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export enum HostClientType {
ipados = 'ipados',
/** The host is running on a macOS client, which runs on devices such as MacBooks. */
macos = 'macos',
/** The host is running on a visionOS client, which runs on devices such as Apple Vision. */
visionOS = 'visionOS',
/**
* @deprecated
* As of TeamsJS v2.0.0, please use {@link teamsRoomsWindows} instead.
Expand Down
7 changes: 4 additions & 3 deletions packages/teams-js/src/public/nestedAppAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ export function isNAAChannelRecommended(): boolean {

function isNAAChannelRecommendedForLegacyTeamsMobile(): boolean {
return ensureInitialized(runtime) &&
isHostAndroidOrIOSOrIPadOS() &&
isHostAndroidOrIOSOrIPadOSOrVisionOS() &&
runtime.isLegacyTeams &&
runtime.supports.nestedAppAuth
? true
: false;
}

function isHostAndroidOrIOSOrIPadOS(): boolean {
function isHostAndroidOrIOSOrIPadOSOrVisionOS(): boolean {
wyAbhishek marked this conversation as resolved.
Show resolved Hide resolved
return (
GlobalVars.hostClientType === HostClientType.android ||
GlobalVars.hostClientType === HostClientType.ios ||
GlobalVars.hostClientType === HostClientType.ipados
GlobalVars.hostClientType === HostClientType.ipados ||
GlobalVars.hostClientType === HostClientType.visionOS
);
}
9 changes: 7 additions & 2 deletions packages/teams-js/src/public/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,12 @@ const v1NonMobileHostClientTypes = [
HostClientType.teamsDisplays,
];

export const v1MobileHostClientTypes = [HostClientType.android, HostClientType.ios, HostClientType.ipados];
export const v1MobileHostClientTypes = [
HostClientType.android,
HostClientType.ios,
HostClientType.ipados,
HostClientType.visionOS,
];

export const v1HostClientTypes = [...v1NonMobileHostClientTypes, ...v1MobileHostClientTypes];

Expand Down Expand Up @@ -596,7 +601,7 @@ export const mapTeamsVersionToSupportedCapabilities: Record<string, Array<ICapab
'2.1.1': [
{
capability: { nestedAppAuth: {} },
hostClientTypes: [HostClientType.android, HostClientType.ios, HostClientType.ipados],
hostClientTypes: [HostClientType.android, HostClientType.ios, HostClientType.ipados, HostClientType.visionOS],
},
],
};
Expand Down
3 changes: 2 additions & 1 deletion packages/teams-js/src/public/webStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export async function isWebStorageClearedOnUserLogOut(): Promise<boolean> {
runtime.isLegacyTeams &&
(GlobalVars.hostClientType === HostClientType.android ||
GlobalVars.hostClientType === HostClientType.ios ||
GlobalVars.hostClientType === HostClientType.ipados) &&
GlobalVars.hostClientType === HostClientType.ipados ||
GlobalVars.hostClientType === HostClientType.visionOS) &&
(await getHostName()) === HostName.teams
) {
// On Teams Mobile, they haven't yet implemented this capability. However, for compatibility reasons, we need
Expand Down
1 change: 1 addition & 0 deletions packages/teams-js/test/public/authentication.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ describe('Testing authentication capability', () => {
HostClientType.ios,
HostClientType.ipados,
HostClientType.macos,
HostClientType.visionOS,
HostClientType.rigel,
HostClientType.teamsRoomsWindows,
HostClientType.teamsRoomsAndroid,
Expand Down
1 change: 1 addition & 0 deletions packages/teams-js/test/public/clipboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ describe('clipboard', () => {
HostClientType.desktop,
HostClientType.ios,
HostClientType.ipados,
HostClientType.visionOS,
HostClientType.macos,
]).forEach((mobilePlatform) => {
if (allowedContexts.some((allowedContext) => allowedContext === context)) {
Expand Down
Loading