Ability to copying authorization URL for Gmail (#375)
* Implemented copying auth URL for Gmail authentication. * Update Button icon and add row spacing in Flyout grid The icon used in the Button.Content has been updated to a new design and is now wrapped inside a Viewbox with a width of 20 to ensure proper scaling. Additionally, the Grid inside the Flyout now includes RowSpacing="12" to improve visual separation between rows.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
x:Name="Root"
|
||||
Closing="DialogClosing"
|
||||
CornerRadius="8"
|
||||
mc:Ignorable="d">
|
||||
<Grid x:Name="RootGrid" RowSpacing="10">
|
||||
@@ -31,15 +32,56 @@
|
||||
Text="{x:Bind domain:Translator.AccountCreationDialog_Initializing}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<Button
|
||||
x:Name="AuthHelpDialogButton"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Visibility="Collapsed">
|
||||
<Button.Content>
|
||||
<Viewbox Width="20">
|
||||
<PathIcon Data="M960 4q132 0 254 34t228 96 194 150 149 193 97 229 34 254q0 132-34 254t-96 228-150 194-193 149-229 97-254 34q-132 0-254-34t-228-96-194-150-149-193-97-229T4 960q0-132 34-254t96-228 150-194 193-149 229-97T960 4zm0 1792q115 0 222-30t200-84 169-131 130-169 85-200 30-222q0-115-30-222t-84-200-131-169-169-130-200-85-222-30q-115 0-222 30t-200 84-169 131-130 169-85 200-30 222q0 115 30 222t84 200 131 169 169 130 200 85 222 30zm-64-388h128v128H896v-128zm64-960q66 0 124 25t101 69 69 102 26 124q0 60-19 104t-47 81-62 65-61 59-48 63-19 76v64H896v-64q0-60 19-104t47-81 62-65 61-59 48-63 19-76q0-40-15-75t-41-61-61-41-75-15q-40 0-75 15t-61 41-41 61-15 75H640q0-66 25-124t68-101 102-69 125-26z" />
|
||||
</Viewbox>
|
||||
</Button.Content>
|
||||
<Button.Flyout>
|
||||
<Flyout Placement="Bottom">
|
||||
<Grid MaxWidth="400" RowSpacing="12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Foreground="Yellow" TextWrapping="WrapWholeWords">
|
||||
<Run FontWeight="SemiBold" Text="{x:Bind domain:Translator.AccountCreationDialog_GoogleAuthHelpClipboardText_Row0}" />
|
||||
<LineBreak />
|
||||
<LineBreak />
|
||||
<Run Text="{x:Bind domain:Translator.AccountCreationDialog_GoogleAuthHelpClipboardText_Row1}" />
|
||||
<LineBreak />
|
||||
<Run Text="{x:Bind domain:Translator.AccountCreationDialog_GoogleAuthHelpClipboardText_Row2}" />
|
||||
<LineBreak />
|
||||
<Run Text="{x:Bind domain:Translator.AccountCreationDialog_GoogleAuthHelpClipboardText_Row3}" />
|
||||
</TextBlock>
|
||||
|
||||
<Button
|
||||
x:Name="CopyClipboard"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Click="CopyClicked"
|
||||
Content="{x:Bind domain:Translator.Buttons_Copy}" />
|
||||
</Grid>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
x:Name="CancelButton"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Center"
|
||||
Click="CancelClicked"
|
||||
VerticalAlignment="Bottom"
|
||||
Click="CancelClicked"
|
||||
Content="{x:Bind domain:Translator.Buttons_Cancel}" />
|
||||
|
||||
</Grid>
|
||||
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="DialogStates">
|
||||
<VisualState x:Name="PreparingFolders">
|
||||
|
||||
@@ -1,15 +1,42 @@
|
||||
namespace Wino.Dialogs
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Messaging.Server;
|
||||
|
||||
namespace Wino.Dialogs
|
||||
{
|
||||
public sealed partial class AccountCreationDialog : BaseAccountCreationDialog
|
||||
public sealed partial class AccountCreationDialog : BaseAccountCreationDialog, IRecipient<CopyAuthURLRequested>
|
||||
{
|
||||
private string copyClipboardURL;
|
||||
public AccountCreationDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
WeakReferenceMessenger.Default.Register(this);
|
||||
}
|
||||
|
||||
private void CancelClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
public async void Receive(CopyAuthURLRequested message)
|
||||
{
|
||||
Complete(true);
|
||||
copyClipboardURL = message.AuthURL;
|
||||
|
||||
await Task.Delay(2000);
|
||||
|
||||
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
AuthHelpDialogButton.Visibility = Windows.UI.Xaml.Visibility.Visible;
|
||||
});
|
||||
}
|
||||
|
||||
private void CancelClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e) => Complete(true);
|
||||
|
||||
private async void CopyClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(copyClipboardURL)) return;
|
||||
|
||||
var clipboardService = App.Current.Services.GetService<IClipboardService>();
|
||||
await clipboardService.CopyClipboardAsync(copyClipboardURL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Wino.Dialogs
|
||||
public static readonly DependencyProperty StateProperty = DependencyProperty.Register(nameof(State), typeof(AccountCreationDialogState), typeof(BaseAccountCreationDialog), new PropertyMetadata(AccountCreationDialogState.Idle));
|
||||
|
||||
// Prevent users from dismissing it by ESC key.
|
||||
private void DialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args)
|
||||
public void DialogClosing(ContentDialog sender, ContentDialogClosingEventArgs args)
|
||||
{
|
||||
if (args.Result == ContentDialogResult.None)
|
||||
{
|
||||
|
||||
@@ -2,26 +2,26 @@
|
||||
x:Class="Wino.Dialogs.NewAccountDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:accounts="using:Wino.Core.Domain.Models.Accounts"
|
||||
Title="{x:Bind domain:Translator.NewAccountDialog_Title}"
|
||||
Style="{StaticResource WinoDialogStyle}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
Title="{x:Bind domain:Translator.NewAccountDialog_Title}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
DefaultButton="Primary"
|
||||
IsPrimaryButtonEnabled="False"
|
||||
Opened="DialogOpened"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
PrimaryButtonClick="CreateClicked"
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="{x:Bind domain:Translator.Buttons_CreateAccount}"
|
||||
SecondaryButtonClick="CancelClicked"
|
||||
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
|
||||
Style="{StaticResource WinoDialogStyle}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ContentDialog.Resources>
|
||||
<DataTemplate x:Key="NewMailProviderTemplate" x:DataType="accounts:ProviderDetail">
|
||||
<Grid Padding="6" Margin="0,8">
|
||||
<Grid Margin="0,8" Padding="6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -31,10 +31,10 @@
|
||||
Height="35"
|
||||
Source="{x:Bind ProviderImage}" />
|
||||
<StackPanel
|
||||
Spacing="2"
|
||||
Grid.Column="1"
|
||||
Margin="12,0"
|
||||
VerticalAlignment="Center">
|
||||
VerticalAlignment="Center"
|
||||
Spacing="2">
|
||||
<TextBlock FontWeight="Bold" Text="{x:Bind Name}" />
|
||||
<TextBlock Text="{x:Bind Description}" />
|
||||
</StackPanel>
|
||||
@@ -71,7 +71,6 @@
|
||||
|
||||
<ListView
|
||||
Grid.Row="2"
|
||||
|
||||
Padding="0"
|
||||
ItemTemplate="{StaticResource NewMailProviderTemplate}"
|
||||
ItemsSource="{x:Bind Providers}"
|
||||
|
||||
Reference in New Issue
Block a user