From 1c85fea7a7aa4c3bc70cb91db31539394eb0863e Mon Sep 17 00:00:00 2001 From: Jay Ongg Date: Mon, 25 Sep 2017 22:03:13 -0700 Subject: [PATCH] Catch up Microsoft Teams SDK with what we support today. (#20019) * Added some new types/methods. context.isFullScreen? microsoftteams.getTabInstances as well as the TabInstance and TabInformation interfaces * add the teamType type * Update to remove unnecessary/incorrect comment. * Update Microsoft Teams's index.d.ts to match current spec. index.d.ts modified by copying the output of the microsoft-teams-library-js resultant .d.ts file * Increase the version number in the header of the index.d.ts * Fixed tslint error --- types/microsoftteams/index.d.ts | 47 +++++++++++++++++++- types/microsoftteams/microsoftteams-tests.ts | 5 +++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/types/microsoftteams/index.d.ts b/types/microsoftteams/index.d.ts index f598a09b06..a463cb4daa 100644 --- a/types/microsoftteams/index.d.ts +++ b/types/microsoftteams/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for microsoftteams 1.0 +// Type definitions for microsoftteams 1.1 // Project: https://github.com/OfficeDev/microsoft-teams-library-js -// Definitions by: OfficeDev +// Definitions by: Bhargav Krishna +// Jay Ongg +// Yuri Dogandjiev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/types/microsoftteams // TypeScript Version: 2.1 // tslint:disable:prefer-method-signature @@ -12,6 +14,29 @@ interface MessageEvent { * This is the root namespace for the JavaScript SDK. */ declare namespace microsoftTeams { + interface TabInformation { + teamTabs: TabInstance[]; + } + interface TabInstance { + tabName: string; + entityId?: string; + channelId?: string; + channelName?: string; + channelIsFavorite?: boolean; + teamId?: string; + teamName?: string; + teamIsFavorite?: boolean; + groupId?: string; + url?: string; + websiteUrl?: string; + } + const enum TeamType { + Standard = 0, + Edu = 1, + Class = 2, + Plc = 3, + Staff = 4, + } /** * Initializes the library. This must be called before any other SDK calls. * The caller should only call this once the frame is loaded successfully. @@ -28,6 +53,12 @@ declare namespace microsoftTeams { * @param handler The handler to invoke when the user changes their theme. */ function registerOnThemeChangeHandler(handler: (theme: string) => void): void; + /** + * Registers a handler for when the user toggle full screen view for tab. + * Only one handler may be registered at a time. Subsequent registrations will override the first. + * @param handler The handler to invoke when the user changes toggle full screen view for tab. + */ + function registerFullScreenHandler(handler: (isFullScreen: boolean) => void): void; /** * Navigates the frame to a new cross-domain URL. The domain of this URL must match at least one of the * valid domains specified in the tab manifest; otherwise, an exception will be thrown. This function only @@ -36,6 +67,10 @@ declare namespace microsoftTeams { * @param url The url to navigate the frame to. */ function navigateCrossDomain(url: string): void; + /** + * Allows an app to retrieve all the tabs in favorite channels where it is enabled for this user + */ + function getTabInstances(callback: (tabInfo: TabInformation) => void): void; /** * Shares a deep link a user can use to navigate back to a specific state in this page. */ @@ -320,6 +355,14 @@ declare namespace microsoftTeams { * The current UI theme the user is using. */ theme?: string; + /** + * Indication whether the tab is in full screen mode. + */ + isFullScreen?: boolean; + /** + * The type of the team. + */ + teamType?: TeamType; } interface DeepLinkParameters { /** diff --git a/types/microsoftteams/microsoftteams-tests.ts b/types/microsoftteams/microsoftteams-tests.ts index 727b8b6f66..a4f8af0884 100644 --- a/types/microsoftteams/microsoftteams-tests.ts +++ b/types/microsoftteams/microsoftteams-tests.ts @@ -8,6 +8,7 @@ (() => { microsoftTeams.getContext(context => { const { upn, channelId } = context; + context.isFullScreen = true; }); microsoftTeams.settings.getSettings(settings => { @@ -33,4 +34,8 @@ url: '', successCallback: done => { } }); + + microsoftTeams.getTabInstances(tabInfo => { + const tabInstances: microsoftTeams.TabInstance[] = tabInfo.teamTabs; + }); })();