From 7da141ec791a0ae7e221e6a5fb4475577bfb846d Mon Sep 17 00:00:00 2001 From: "dennis.gascoigne" <337991+statler@users.noreply.github.com> Date: Tue, 21 Mar 2023 13:55:11 +1100 Subject: [PATCH 1/2] changes for core --- src/Auth.UI.WPF/Auth.UI.WPF.csproj | 1 + src/Auth.UI.WPF/WebAuthenticationBroker.cs | 15 +++++++++++---- src/Auth/FirebaseAuthClient.cs | 4 ++-- src/Auth/Providers/OAuthProvider.cs | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Auth.UI.WPF/Auth.UI.WPF.csproj b/src/Auth.UI.WPF/Auth.UI.WPF.csproj index 6da6d3e..6c6de32 100644 --- a/src/Auth.UI.WPF/Auth.UI.WPF.csproj +++ b/src/Auth.UI.WPF/Auth.UI.WPF.csproj @@ -26,6 +26,7 @@ The library provides a drop-in auth solution that handles the flows for signing Firebase.Auth.UI.WPF Firebase.Auth.UI true + true $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage diff --git a/src/Auth.UI.WPF/WebAuthenticationBroker.cs b/src/Auth.UI.WPF/WebAuthenticationBroker.cs index bc8dca1..405da53 100644 --- a/src/Auth.UI.WPF/WebAuthenticationBroker.cs +++ b/src/Auth.UI.WPF/WebAuthenticationBroker.cs @@ -1,16 +1,18 @@ using Firebase.Auth.UI.Converters; using System.Threading.Tasks; using System.Windows; +using System.Windows.Interop; +using System.Windows.Forms; namespace Firebase.Auth.UI { - internal static class WebAuthenticationBroker + public static class WebAuthenticationBroker { - public static Task AuthenticateAsync(Window owner, FirebaseProviderType provider, string uri, string redirectUri) + public static Task AuthenticateAsync(object owner, FirebaseProviderType provider, string uri, string redirectUri) { var tcs = new TaskCompletionSource(); - Application.Current.Dispatcher.Invoke(() => + System.Windows.Application.Current.Dispatcher.Invoke(() => { var window = new WebAuthenticationBrokerWindow(); window.WebView.NavigationCompleted += (s, e) => @@ -25,7 +27,12 @@ public static Task AuthenticateAsync(Window owner, FirebaseProviderType }; window.Title = ProviderToTitleConverter.Convert(provider); window.WebView.Loaded += (s, e) => window.WebView.Source = new System.Uri(uri); - window.Owner = owner; + if (owner is Window owner_window) window.Owner = owner_window; + else if (owner is Form owner_form) + { + WindowInteropHelper helper = new WindowInteropHelper(window); + helper.Owner = owner_form.Handle; + } if (!(window.ShowDialog() ?? false)) { tcs.SetResult(null); diff --git a/src/Auth/FirebaseAuthClient.cs b/src/Auth/FirebaseAuthClient.cs index 0ea5b9d..5f4db53 100644 --- a/src/Auth/FirebaseAuthClient.cs +++ b/src/Auth/FirebaseAuthClient.cs @@ -204,12 +204,12 @@ private void TriggerAuthStateChanged(EventHandler value, User use value?.Invoke(this, new UserEventArgs(user)); } - private void SaveToken(User user) + public void SaveToken(User user) { this.config.UserManager.SaveNewUser(user); } - private async Task CheckAuthDomain() + public async Task CheckAuthDomain() { if (this.domainChecked) { diff --git a/src/Auth/Providers/OAuthProvider.cs b/src/Auth/Providers/OAuthProvider.cs index 6e8fea3..2d9689d 100644 --- a/src/Auth/Providers/OAuthProvider.cs +++ b/src/Auth/Providers/OAuthProvider.cs @@ -58,7 +58,7 @@ internal virtual AuthCredential GetCredential(VerifyAssertionResponse response) response.PendingToken == null ? OAuthCredentialTokenType.AccessToken : OAuthCredentialTokenType.PendingToken); } - internal virtual async Task SignInAsync() + public virtual async Task SignInAsync() { if (this.LocaleParameterName != null && !this.parameters.ContainsKey(this.LocaleParameterName)) { From 869c72ead38dd32d2f8b6b8f7fe783a5c510fb42 Mon Sep 17 00:00:00 2001 From: "dennis.gascoigne" <337991+statler@users.noreply.github.com> Date: Thu, 23 Mar 2023 15:07:22 +1100 Subject: [PATCH 2/2] Upgrading libraries - all working except overwriting automapper profiles --- src/Auth.UI.WPF/Auth.UI.WPF.csproj | 12 ++++++------ src/Auth/Auth.csproj | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Auth.UI.WPF/Auth.UI.WPF.csproj b/src/Auth.UI.WPF/Auth.UI.WPF.csproj index 6c6de32..96169c1 100644 --- a/src/Auth.UI.WPF/Auth.UI.WPF.csproj +++ b/src/Auth.UI.WPF/Auth.UI.WPF.csproj @@ -33,12 +33,12 @@ The library provides a drop-in auth solution that handles the flows for signing - <_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))"/> + <_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))" /> - + @@ -51,9 +51,9 @@ The library provides a drop-in auth solution that handles the flows for signing - - - + + + @@ -63,7 +63,7 @@ The library provides a drop-in auth solution that handles the flows for signing - + diff --git a/src/Auth/Auth.csproj b/src/Auth/Auth.csproj index c557395..8cf0795 100644 --- a/src/Auth/Auth.csproj +++ b/src/Auth/Auth.csproj @@ -42,7 +42,7 @@ FirebaseUI is supported by platform-specific libraries: - +