Esempio n. 1
0
        /// <summary>
        /// Displays a popup with prompt to grant specified consents.
        /// </summary>
        /// <param name="request">Requests for user consents</param>
        /// <param name="popupStyles">Styles to use for the popup</param>
        /// <returns>Result containing user consents</returns>
        public async Task <ConsentFormResult> DisplayConsentRequest(DisplayConsentFormRequest request, StyleSheet popupStyles = null)
        {
            var tcs = new TaskCompletionSource <ConsentFormResult>();

            void resultHandler(ConsentFormResult result)
            {
                Apply(result);
                tcs.SetResult(result);
            }

            var popup = new UI.ConsentFormPage(ToConsentForm(request), popupStyles, resultHandler);
            await PopupNavigation.Instance.PushAsync(popup);

            return(await tcs.Task);
        }
Esempio n. 2
0
 private ConsentForm ToConsentForm(DisplayConsentFormRequest request)
 => new ConsentForm(
     request.Title,
     request.Rationale,
     request.ConfirmationButtonText,
     request.Requests.Select(req => new ConsentRequest(req.ConsentKey, req.Description, IsGranted(req.ConsentKey))));