Skip to content

Commit 7da141e

Browse files
committed
changes for core
1 parent 419936f commit 7da141e

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/Auth.UI.WPF/Auth.UI.WPF.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The library provides a drop-in auth solution that handles the flows for signing
2626
<AssemblyName>Firebase.Auth.UI.WPF</AssemblyName>
2727
<RootNamespace>Firebase.Auth.UI</RootNamespace>
2828
<UseWPF>true</UseWPF>
29+
<UseWindowsForms>true</UseWindowsForms>
2930
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
3031
</PropertyGroup>
3132

src/Auth.UI.WPF/WebAuthenticationBroker.cs

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
using Firebase.Auth.UI.Converters;
22
using System.Threading.Tasks;
33
using System.Windows;
4+
using System.Windows.Interop;
5+
using System.Windows.Forms;
46

57
namespace Firebase.Auth.UI
68
{
7-
internal static class WebAuthenticationBroker
9+
public static class WebAuthenticationBroker
810
{
9-
public static Task<string> AuthenticateAsync(Window owner, FirebaseProviderType provider, string uri, string redirectUri)
11+
public static Task<string> AuthenticateAsync(object owner, FirebaseProviderType provider, string uri, string redirectUri)
1012
{
1113
var tcs = new TaskCompletionSource<string>();
1214

13-
Application.Current.Dispatcher.Invoke(() =>
15+
System.Windows.Application.Current.Dispatcher.Invoke(() =>
1416
{
1517
var window = new WebAuthenticationBrokerWindow();
1618
window.WebView.NavigationCompleted += (s, e) =>
@@ -25,7 +27,12 @@ public static Task<string> AuthenticateAsync(Window owner, FirebaseProviderType
2527
};
2628
window.Title = ProviderToTitleConverter.Convert(provider);
2729
window.WebView.Loaded += (s, e) => window.WebView.Source = new System.Uri(uri);
28-
window.Owner = owner;
30+
if (owner is Window owner_window) window.Owner = owner_window;
31+
else if (owner is Form owner_form)
32+
{
33+
WindowInteropHelper helper = new WindowInteropHelper(window);
34+
helper.Owner = owner_form.Handle;
35+
}
2936
if (!(window.ShowDialog() ?? false))
3037
{
3138
tcs.SetResult(null);

src/Auth/FirebaseAuthClient.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,12 @@ private void TriggerAuthStateChanged(EventHandler<UserEventArgs> value, User use
204204
value?.Invoke(this, new UserEventArgs(user));
205205
}
206206

207-
private void SaveToken(User user)
207+
public void SaveToken(User user)
208208
{
209209
this.config.UserManager.SaveNewUser(user);
210210
}
211211

212-
private async Task CheckAuthDomain()
212+
public async Task CheckAuthDomain()
213213
{
214214
if (this.domainChecked)
215215
{

src/Auth/Providers/OAuthProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal virtual AuthCredential GetCredential(VerifyAssertionResponse response)
5858
response.PendingToken == null ? OAuthCredentialTokenType.AccessToken : OAuthCredentialTokenType.PendingToken);
5959
}
6060

61-
internal virtual async Task<OAuthContinuation> SignInAsync()
61+
public virtual async Task<OAuthContinuation> SignInAsync()
6262
{
6363
if (this.LocaleParameterName != null && !this.parameters.ContainsKey(this.LocaleParameterName))
6464
{

0 commit comments

Comments
 (0)