Skip to content

Commit 1c43e82

Browse files
authored
Merge pull request #639 from AvaloniaUI/fixes/webview-tweaks
Accelerate WebView tweaks
2 parents 5816105 + 31bb6f7 commit 1c43e82

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

accelerate/components/webview/nativewebdialog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ var dialog = new NativeWebDialog
224224

225225
// Create TaskCompletionSource so we can wait until window is closed.
226226
var tcs = new TaskCompletionSource();
227-
dialog.Closing += (s, e) => tcs.SetCompleted();
227+
dialog.Closing += (s, e) => tcs.SetResult();
228228

229229
// Show the dialog
230230
dialog.Show(mainWindow);

accelerate/components/webview/quickstart.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,10 @@ For multi-project solutions, you can store your license key in an [environment v
9090

9191
```xml
9292
<Window xmlns="https://github.com/avaloniaui"
93-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
94-
xmlns:webview="using:Avalonia.Controls.WebView">
93+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
9594

96-
<webview:NativeWebView Source="https://avaloniaui.net/"
97-
NavigationCompleted="WebView_NavigationCompleted" />
95+
<NativeWebView Source="https://avaloniaui.net/"
96+
NavigationCompleted="WebView_NavigationCompleted" />
9897
</Window>
9998
```
10099

@@ -132,7 +131,7 @@ dialog.Show();
132131
### Using WebAuthenticationBroker
133132

134133
```csharp
135-
var authOptions = new WebAuthenticationOptions(
134+
var authOptions = new WebAuthenticatorOptions(
136135
RequestUri: new Uri("https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=http://localhost&scope=openid"),
137136
RedirectUri: new Uri("http://localhost")
138137
);
@@ -146,6 +145,8 @@ if (result.CallbackUri != null)
146145
}
147146
```
148147

148+
Replace `YOUR_CLIENT_ID` with the client ID for your application.
149+
149150
## Platform Prerequisites
150151

151152
The WebView component relies on native web rendering implementations that must be available on the user's machine:

accelerate/components/webview/webauthenticationbroker.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ googleAuthRequestUri += "&redirect_uri=" + googleAuthRedirectUri;
7373

7474
var result = await WebAuthenticationBroker.AuthenticateAsync(
7575
mainWindow,
76-
new WebAuthenticationOptions(
77-
RequestUri: new Uri(googleAuthRequestUri)
78-
RedirectUri: new Uri(googleAuthRedirectUri));
76+
new WebAuthenticatorOptions(
77+
RequestUri: new Uri(googleAuthRequestUri),
78+
RedirectUri: new Uri(googleAuthRedirectUri)));
7979
```
8080

8181
Similarly it can be done with [Microsoft identity](https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow), [Facebook Login](https://developers.facebook.com/docs/facebook-login/) or other OAuth2 standard compatible options.
@@ -87,6 +87,6 @@ Similarly it can be done with [Microsoft identity](https://learn.microsoft.com/e
8787
| Platform Implementation ||* ||* |** |*** |
8888
| NativeWebDialog |||||||
8989

90-
\* Apple platforms use ASWebAuthenticationSession implementation.
91-
\** Android uses CustomTabsIntent implementation, but support is experimental and might be changed.
92-
\*** Browser solution requires CORS to be configured to allow access to the redirected page.
90+
\* Apple platforms use ASWebAuthenticationSession implementation.
91+
\** Android uses CustomTabsIntent implementation, but support is experimental and might be changed.
92+
\*** Browser solution requires CORS to be configured to allow access to the redirected page.

0 commit comments

Comments
 (0)