-
-
Notifications
You must be signed in to change notification settings - Fork 554
/
Copy pathMainActivity.cs
31 lines (28 loc) · 1.27 KB
/
MainActivity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Android.App;
using Android.Content.PM;
using OpenIddict.Client.SystemIntegration;
using Intent = Android.Content.Intent;
namespace OpenIddict.Sandbox.Maui.Client
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true,
LaunchMode = LaunchMode.SingleTop,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
// Intent filter for custom URI scheme
[IntentFilter(new[] { Intent.ActionView },
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
DataScheme = "com.openiddict.sandbox.maui.client")]
public class MainActivity : MauiAppCompatActivity
{
protected override async void OnNewIntent(Intent? intent)
{
base.OnNewIntent(intent);
// Handle the custom URL scheme
if (intent?.Data is not null &&
IPlatformApplication.Current?.Services is IServiceProvider provider)
{
var scheme = intent?.Data?.Scheme;
await provider.GetRequiredService<OpenIddictClientSystemIntegrationService>().HandleCustomTabsIntentAsync(intent!);
}
}
}
}