From a622a5e8596ef384532a413861b9661f3dc7687c Mon Sep 17 00:00:00 2001 From: Yuri Dogandjiev Date: Tue, 11 Sep 2018 12:36:13 -0700 Subject: [PATCH] Make tasks.submitTask backwards compatible and prepare to release v1.3.5 of the SDK --- README.md | 6 +++--- package.json | 2 +- src/MicrosoftTeams.ts | 5 +++-- test/MicrosoftTeams.spec.ts | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d119e4a96c..183377994b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To install the stable version: #### Production -You can access [these files on unpkg](https://unpkg.com/@microsoft/teams-js@1.3.4/dist/MicrosoftTeams.min.js), download them, or point your package manager to them. +You can access [these files on unpkg](https://unpkg.com/@microsoft/teams-js@1.3.5/dist/MicrosoftTeams.min.js), download them, or point your package manager to them. ## Usage @@ -46,10 +46,10 @@ Reference the library inside of your `.html` page using: ```html - + - + diff --git a/package.json b/package.json index 09bb4dac84..ff90cb4ef6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@microsoft/teams-js", "author": "Microsoft Teams", - "version": "1.3.4", + "version": "1.3.5", "description": "Microsoft Client SDK for building app for Microsoft teams", "main": "./dist/MicrosoftTeams.min.js", "typings": "./dist/MicrosoftTeams.d.ts", diff --git a/src/MicrosoftTeams.ts b/src/MicrosoftTeams.ts index f571b6e5d2..3516c5a663 100644 --- a/src/MicrosoftTeams.ts +++ b/src/MicrosoftTeams.ts @@ -44,7 +44,7 @@ interface Window { namespace microsoftTeams { "use strict"; - const version = "1.3.4"; + const version = "1.3.5"; const validOrigins = [ "https://teams.microsoft.com", @@ -2110,7 +2110,8 @@ namespace microsoftTeams { ): void { ensureInitialized(frameContexts.content, frameContexts.task); - sendMessageRequest(parentWindow, "tasks.submitTask", [ + // Send tasks.completeTask instead of tasks.submitTask message for backward compatibility with Mobile clients + sendMessageRequest(parentWindow, "tasks.completeTask", [ result, Array.isArray(appIds) ? appIds : [appIds] ]); diff --git a/test/MicrosoftTeams.spec.ts b/test/MicrosoftTeams.spec.ts index c1bed11a6a..d4b888586a 100644 --- a/test/MicrosoftTeams.spec.ts +++ b/test/MicrosoftTeams.spec.ts @@ -129,7 +129,7 @@ describe("MicrosoftTeams", () => { expect(initMessage.id).toBe(0); expect(initMessage.func).toBe("initialize"); expect(initMessage.args.length).toEqual(1); - expect(initMessage.args[0]).toEqual("1.3.4"); + expect(initMessage.args[0]).toEqual("1.3.5"); }); it("should allow multiple initialize calls", () => { @@ -1406,7 +1406,7 @@ describe("MicrosoftTeams", () => { "someOtherAppId" ]); - const submitTaskMessage = findMessageByFunc("tasks.submitTask"); + const submitTaskMessage = findMessageByFunc("tasks.completeTask"); expect(submitTaskMessage).not.toBeNull(); expect(submitTaskMessage.args).toEqual([ "someResult", @@ -1419,7 +1419,7 @@ describe("MicrosoftTeams", () => { microsoftTeams.tasks.submitTask("someResult", "someAppId"); - const submitTaskMessage = findMessageByFunc("tasks.submitTask"); + const submitTaskMessage = findMessageByFunc("tasks.completeTask"); expect(submitTaskMessage).not.toBeNull(); expect(submitTaskMessage.args).toEqual(["someResult", ["someAppId"]]); });