right doc, wrong function

pull/21833/head
David Baker 2019-07-10 14:22:50 +01:00
parent 0ec57b58e8
commit f7750d9df0
1 changed files with 9 additions and 3 deletions

View File

@ -43,9 +43,6 @@ export class Service {
* Present a popup to the user prompting them to agree to terms and conditions * Present a popup to the user prompting them to agree to terms and conditions
* *
* @param {Service[]} services Object with keys 'serviceType', 'baseUrl', 'accessToken' * @param {Service[]} services Object with keys 'serviceType', 'baseUrl', 'accessToken'
* @param {function} dialogTermsInteractionCallback Function called with an array of:
* { service: {Service}, terms: {terms response from API} }
* Must return a Promise which resolves with a list of URLs of documents agreed to
* @returns {Promise} resolves when the user agreed to all necessary terms or rejects * @returns {Promise} resolves when the user agreed to all necessary terms or rejects
* if they cancel. * if they cancel.
*/ */
@ -53,6 +50,15 @@ export function presentTermsForServices(services) {
return startTermsFlow(services, dialogTermsInteractionCallback); return startTermsFlow(services, dialogTermsInteractionCallback);
} }
/*
* Start a flow where the user is presented with terms & conditions for some services
*
* @param {function} interactionCallback Function called with an array of:
* { service: {Service}, terms: {terms response from API} }
* Must return a Promise which resolves with a list of URLs of documents agreed to
* @returns {Promise} resolves when the user agreed to all necessary terms or rejects
* if they cancel.
*/
export async function startTermsFlow(services, interactionCallback) { export async function startTermsFlow(services, interactionCallback) {
const termsPromises = services.map( const termsPromises = services.map(
(s) => MatrixClientPeg.get().getTerms(s.serviceType, s.baseUrl, s.accessToken), (s) => MatrixClientPeg.get().getTerms(s.serviceType, s.baseUrl, s.accessToken),