diff --git a/src/SamplesApp/SamplesApp.netcoremobile/SamplesApp.netcoremobile.csproj b/src/SamplesApp/SamplesApp.netcoremobile/SamplesApp.netcoremobile.csproj index 69f34508e484..c80cf74aad71 100644 --- a/src/SamplesApp/SamplesApp.netcoremobile/SamplesApp.netcoremobile.csproj +++ b/src/SamplesApp/SamplesApp.netcoremobile/SamplesApp.netcoremobile.csproj @@ -188,7 +188,7 @@ - + 5.56.0 diff --git a/src/SamplesApp/UITests.Shared/Msal/MsalLoginAndGraph.xaml.cs b/src/SamplesApp/UITests.Shared/Msal/MsalLoginAndGraph.xaml.cs index 6616acd95b04..fe4d6157ce6f 100644 --- a/src/SamplesApp/UITests.Shared/Msal/MsalLoginAndGraph.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Msal/MsalLoginAndGraph.xaml.cs @@ -1,26 +1,35 @@ -using System; +#if DEBUG && __IOS__ // Workaround for https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/2617 +#define DISABLE_GRAPH +#endif +using System; using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; -using Microsoft.Graph; using Microsoft.Identity.Client; -using Microsoft.Kiota.Abstractions; -using Microsoft.Kiota.Abstractions.Authentication; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Imaging; using Uno.UI.MSAL; using Uno.UI.Samples.Controls; using Prompt = Microsoft.Identity.Client.Prompt; +#if !DISABLE_GRAPH +using Microsoft.Kiota.Abstractions; +using Microsoft.Kiota.Abstractions.Authentication; +using Microsoft.Graph; +#endif namespace UITests.Msal { [Sample("MSAL", IgnoreInSnapshotTests = true)] - public sealed partial class MsalLoginAndGraph : Page, IAuthenticationProvider + public sealed partial class MsalLoginAndGraph : Page +#if !DISABLE_GRAPH + , IAuthenticationProvider +#endif { +#if !DISABLE_GRAPH private const string CLIENT_ID = "a74f513b-2d8c-45c0-a15a-15e63f7a7862"; private const string TENANT_ID = "6d53ef61-b6d1-4150-ae0b-43b90e75e0cd"; @@ -37,31 +46,45 @@ public sealed partial class MsalLoginAndGraph : Page, IAuthenticationProvider private readonly string[] SCOPES = new[] { "https://graph.microsoft.com/User.Read", "https://graph.microsoft.com/email", "https://graph.microsoft.com/profile" }; private readonly IPublicClientApplication _app; +#endif public MsalLoginAndGraph() { this.InitializeComponent(); +#if !DISABLE_GRAPH _app = PublicClientApplicationBuilder .Create(CLIENT_ID) .WithTenantId(TENANT_ID) .WithRedirectUri(REDIRECT_URI) .WithUnoHelpers() .Build(); +#endif } - private async void SignIn(object sender, RoutedEventArgs e) + private +#if !DISABLE_GRAPH + async +#endif + void SignIn(object sender, RoutedEventArgs e) { +#if !DISABLE_GRAPH var result = await _app.AcquireTokenInteractive(SCOPES) .WithPrompt(Prompt.SelectAccount) .WithUnoHelpers() .ExecuteAsync(); tokenBox.Text = result.AccessToken; +#endif } - private async void LoadFromGraph(object sender, RoutedEventArgs e) + private +#if !DISABLE_GRAPH + async +#endif + void LoadFromGraph(object sender, RoutedEventArgs e) { +#if !DISABLE_GRAPH var httpClient = new HttpClient(); var client = new GraphServiceClient(httpClient, this); @@ -89,12 +112,15 @@ private async void LoadFromGraph(object sender, RoutedEventArgs e) { Console.Error.WriteLine(exception); } +#endif } +#if !DISABLE_GRAPH Task IAuthenticationProvider.AuthenticateRequestAsync(RequestInformation request, Dictionary additionalAuthenticationContext, CancellationToken cancellationToken) { request.Headers.Add("Authorization", $"Bearer {tokenBox.Text}"); return Task.CompletedTask; } +#endif } } diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/MediaPlayerElement/MediaPlayerElement_Original_MsAppdataSource.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/MediaPlayerElement/MediaPlayerElement_Original_MsAppdataSource.xaml.cs index c06b51397c0f..9816e8c9af47 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/MediaPlayerElement/MediaPlayerElement_Original_MsAppdataSource.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/MediaPlayerElement/MediaPlayerElement_Original_MsAppdataSource.xaml.cs @@ -3,7 +3,6 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; -using Microsoft.Graph; using Uno.UI.Samples.Controls; using Windows.Foundation; using Windows.Foundation.Collections;