<commit_before>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Prism.Forms.Pages;
using Rg.Plugins.Popup.Services;

namespace Prism.Services
{
    public static class CustomPageDialogServiceExtensions
    {
        public static async Task<string> DisplayActionSheetAsync( this IPageDialogService pageDialogService, string title, string message, string cancelButton, string destroyButton, params string[] otherButtons )
        {
            var page = ActionSheetPage.CreatePage( title, message, cancelButton, destroyButton, otherButtons );
            return await pageDialogService.DisplayActionSheetAsync( page );
        }

        public static async Task DisplayActionSheetAsync( this IPageDialogService pageDialogService, string title, string message, params IActionSheetButton[] buttons )
        {
            if( buttons == null || buttons.All( b => b == null ) )
                throw new ArgumentException( "At least one button needs to be supplied", nameof( buttons ) );

            var destroyButton = buttons.FirstOrDefault( button => button != null && button.IsDestroy );
            var cancelButton = buttons.FirstOrDefault( button => button != null && button.IsCancel );
            var otherButtonsText = buttons.Where( button => button != null && !( button.IsDestroy || button.IsCancel ) ).Select( b => b.Text ).ToArray();

            var pressedButton = await pageDialogService.DisplayActionSheetAsync( title, message, cancelButton?.Text, destroyButton?.Text, otherButtonsText );

            foreach( var button in buttons.Where( button => button != null && button.Text.Equals( pressedButton ) ) )
            {
                if( button.Command.CanExecute( button.Text ) )
                    button.Command.Execute( button.Text );

                return;<commit_msg>Changed Extensions namespace so it is Opt-In<commit_after>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Prism.Forms.Pages;
using Rg.Plugins.Popup.Services;

namespace Prism.Services.Extensions
{
    public static class CustomPageDialogServiceExtensions
    {
        public static async Task<string> DisplayActionSheetAsync( this IPageDialogService pageDialogService, string title, string message, string cancelButton, string destroyButton, params string[] otherButtons )
        {
            var page = ActionSheetPage.CreatePage( title, message, cancelButton, destroyButton, otherButtons );
            return await pageDialogService.DisplayActionSheetAsync( page );
        }

        public static async Task DisplayActionSheetAsync( this IPageDialogService pageDialogService, string title, string message, params IActionSheetButton[] buttons )
        {
            if( buttons == null || buttons.All( b => b == null ) )
                throw new ArgumentException( "At least one button needs to be supplied", nameof( buttons ) );

            var destroyButton = buttons.FirstOrDefault( button => button != null && button.IsDestroy );
            var cancelButton = buttons.FirstOrDefault( button => button != null && button.IsCancel );
            var otherButtonsText = buttons.Where( button => button != null && !( button.IsDestroy || button.IsCancel ) ).Select( b => b.Text ).ToArray();

            var pressedButton = await pageDialogService.DisplayActionSheetAsync( title, message, cancelButton?.Text, destroyButton?.Text, otherButtonsText );

            foreach( var button in buttons.Where( button => button != null && button.Text.Equals( pressedButton ) ) )
            {
                if( button.Command.CanExecute( button.Text ) )
                    button.Command.Execute( button.Text );

                return;
{'fraction_non_alphanumeric': 0.09244154431756389, 'fraction_numerical': 0.0, 'mean_word_length': 3.101449275362319, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5655880', 'n_tokens_mistral': 870, 'n_tokens_neox': 862, 'n_words': 271}