Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into maco
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Apr 11, 2020
2 parents 8d4911a + 3f1a380 commit 2501782
Show file tree
Hide file tree
Showing 46 changed files with 479 additions and 125 deletions.
2 changes: 1 addition & 1 deletion DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('uap10.0')) ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.9" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<SDKReference Include="WindowsMobile, Version=10.0.16299.0">
<Name>Windows Mobile Extensions for the UWP</Name>
</SDKReference>
Expand Down
2 changes: 1 addition & 1 deletion DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<ItemGroup>
<PackageReference Include="UnitTests.HeadlessRunner" Version="2.0.0" />
<PackageReference Include="Xamarin.Forms" Version="4.2.0.848062" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.9" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.devices" Version="2.5.25" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspNet.Security.OAuth.Apple" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="3.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="3.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="3.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.1" />
</ItemGroup>

</Project>
6 changes: 5 additions & 1 deletion Samples/Sample.Server.WebAuthenticator/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
Expand Down Expand Up @@ -29,7 +30,10 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();

services.AddAuthentication()
services.AddAuthentication(o =>
{
o.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddCookie()
.AddFacebook(fb =>
{
Expand Down
4 changes: 2 additions & 2 deletions Samples/Samples.Android/Resources/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</style>

<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="MainTheme.Base" parent="Theme.MaterialComponents.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
Expand All @@ -25,7 +25,7 @@
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>

<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<style name="AppCompatDialogStyle" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="colorAccent">#FF4081</item>
</style>

Expand Down
23 changes: 9 additions & 14 deletions Samples/Samples.Android/Samples.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<AndroidDexTool>d8</AndroidDexTool>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<BundleAssemblies>false</BundleAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -58,22 +60,15 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AppCenter" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="3.0.0" />
<PackageReference Include="Xamarin.AndroidX.Migration" Version="1.0.0" />
<PackageReference Include="Xamarin.Forms" Version="4.5.0.356" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="4.5.0.356" />
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.0.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0-rc2" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.1.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
Expand Down
4 changes: 3 additions & 1 deletion Samples/Samples.Android/proguard.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

-dontwarn android.support.**

-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.widget.** { *; }

-keep public class androidx.appcompat.widget.FitWindowsFrameLayout
3 changes: 3 additions & 0 deletions Samples/Samples.UWP/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<uap:Capability Name="contacts"/>
<DeviceCapability Name="location" />
<DeviceCapability Name="microphone"/>
<DeviceCapability Name="webcam"/>
</Capabilities>
</Package>
22 changes: 11 additions & 11 deletions Samples/Samples.UWP/Samples.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AssemblyName>Samples.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
Expand Down Expand Up @@ -115,20 +115,15 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AppCenter" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="3.0.0" />
<PackageReference Include="Xamarin.Forms" Version="4.5.0.356" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="4.5.0.356" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.9" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsMobile, Version=10.0.16299.0">
<Name>Windows Mobile Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Xamarin.Essentials\Xamarin.Essentials.csproj">
<Project>{63a4f6a1-48bf-4d32-aed7-82f605edb042}</Project>
Expand Down Expand Up @@ -199,6 +194,11 @@
<Content Include="Assets\Wide310x150Logo.scale-400.png" />
<Content Include="Properties\Default.rd.xml" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="WindowsMobile, Version=10.0.18362.0">
<Name>Windows Mobile Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand Down
11 changes: 6 additions & 5 deletions Samples/Samples.iOS/Samples.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchLink>Full</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<MtouchExtraArgs>--linkskip=Xamarin.Forms.Platform.iOS --linkskip=Xamarin.Forms.Platform --linkskip=Xamarin.Forms.Core --linkskip=Xamarin.Forms.Xaml --linkskip=Samples</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -72,10 +73,10 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AppCenter" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="3.0.0" />
<PackageReference Include="Xamarin.Forms" Version="4.5.0.356" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="4.5.0.356" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
Expand Down
8 changes: 4 additions & 4 deletions Samples/Samples/Samples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AppCenter" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="2.1.1" />
<PackageReference Include="Microsoft.AppCenter" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="3.0.0" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="3.0.0" />
<PackageReference Include="Xamarin.Forms" Version="4.5.0.356" />
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="4.5.0.356" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
Expand Down
19 changes: 19 additions & 0 deletions Samples/Samples/View/BrowserPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@
ItemsSource="{Binding AllColors}"
SelectedIndex="{Binding ControlColor, Mode=TwoWay}" />

<Label Text="Flags:" />

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Label Text="Launch Adjacent (Android)" Grid.Column="0" Grid.Row="0" />
<Switch IsToggled="{Binding LaunchAdjacent, Mode=TwoWay}" Grid.Column="1" Grid.Row="0" />

<Label Text="Present as Form Sheet (iOS)" Grid.Column="0" Grid.Row="1" />
<Switch IsToggled="{Binding PresentAsFormSheet, Mode=TwoWay}" Grid.Column="1" Grid.Row="1" />

<Label Text="Present as Page Sheet (iOS)" Grid.Column="0" Grid.Row="2" />
<Switch IsToggled="{Binding PresentAsPageSheet, Mode=TwoWay}" Grid.Column="1" Grid.Row="2" />

</Grid>

<Label Text="{Binding BrowserStatus}" />
</StackLayout>
</ScrollView>
Expand Down
4 changes: 2 additions & 2 deletions Samples/Samples/View/WebAuthenticatorPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<Button Text="Facebook" Command="{Binding FacebookCommand}" BackgroundColor="#3b5998" TextColor="White" />
<Button Text="Apple" Command="{Binding AppleCommand}" BackgroundColor="Black" TextColor="White" />

<Label Text="Access Token:" FontAttributes="Bold" Margin="12,12,12,0" />
<Label Text="{Binding AccessToken}" TextColor="Red" FontAttributes="Italic" />
<Label Text="Auth Token:" FontAttributes="Bold" Margin="12,12,12,0" />
<Label Text="{Binding AuthToken}" TextColor="Red" FontAttributes="Italic" />
</StackLayout>
</ScrollView>
</StackLayout>
Expand Down
32 changes: 31 additions & 1 deletion Samples/Samples/ViewModel/BrowserViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public class BrowserViewModel : BaseViewModel
int browserTitleType = (int)BrowserTitleMode.Default;
int controlColor = 0;
int toolbarColor = 0;
bool presentAsFormSheet = false;
bool presentAsPageSheet = false;
bool launchAdjacent = false;

Dictionary<string, Color> colorDictionary;

Expand Down Expand Up @@ -89,6 +92,24 @@ public int ControlColor
set => SetProperty(ref controlColor, value);
}

public bool PresentAsFormSheet
{
get => presentAsFormSheet;
set => SetProperty(ref presentAsFormSheet, value);
}

public bool PresentAsPageSheet
{
get => presentAsPageSheet;
set => SetProperty(ref presentAsPageSheet, value);
}

public bool LaunchAdjacent
{
get => launchAdjacent;
set => SetProperty(ref launchAdjacent, value);
}

async void OpenUri()
{
if (IsBusy)
Expand All @@ -97,12 +118,21 @@ async void OpenUri()
IsBusy = true;
try
{
var flags = BrowserLaunchFlags.None;
if (PresentAsPageSheet)
flags |= BrowserLaunchFlags.PresentAsPageSheet;
if (PresentAsFormSheet)
flags |= BrowserLaunchFlags.PresentAsFormSheet;
if (LaunchAdjacent)
flags |= BrowserLaunchFlags.LaunchAdjacent;

await Browser.OpenAsync(uri, new BrowserLaunchOptions
{
LaunchMode = (BrowserLaunchMode)BrowserType,
TitleMode = (BrowserTitleMode)BrowserTitleType,
PreferredToolbarColor = GetColor(ToolbarColor),
PreferredControlColor = GetColor(ControlColor)
PreferredControlColor = GetColor(ControlColor),
Flags = flags
});
}
catch (Exception e)
Expand Down
6 changes: 3 additions & 3 deletions Samples/Samples/ViewModel/WebAuthenticatorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public WebAuthenticatorViewModel()

string accessToken = string.Empty;

public string AccessToken
public string AuthToken
{
get => accessToken;
set => SetProperty(ref accessToken, value);
Expand All @@ -54,11 +54,11 @@ async Task OnAuthenticate(string scheme)
r = await WebAuthenticator.AuthenticateAsync(authUrl, callbackUrl);
}

AccessToken = r?.AccessToken;
AuthToken = r?.AccessToken ?? r?.IdToken;
}
catch (Exception ex)
{
AccessToken = string.Empty;
AuthToken = string.Empty;
await DisplayAlertAsync($"Failed: {ex.Message}");
}
}
Expand Down
38 changes: 27 additions & 11 deletions Xamarin.Essentials/Browser/Browser.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,40 @@ static Task<bool> PlatformOpenAsync(Uri uri, BrowserLaunchOptions options)
tabsBuilder.SetShowTitle(options.TitleMode == BrowserTitleMode.Show);

var tabsIntent = tabsBuilder.Build();
var flags = ActivityFlags.ClearTop | ActivityFlags.NewTask;
ActivityFlags? tabsFlags = null;

Context context = Platform.GetCurrentActivity(false);

if (context == null)
{
context = Platform.AppContext;

// If using ApplicationContext we need to set ClearTop/NewTask (See #225)
tabsFlags = ActivityFlags.ClearTop | ActivityFlags.NewTask;
}

#if __ANDROID_24__
if (Platform.HasApiLevelN)
flags |= ActivityFlags.LaunchAdjacent;
if (Platform.HasApiLevelN && options.HasFlag(BrowserLaunchFlags.LaunchAdjacent))
{
if (tabsFlags.HasValue)
tabsFlags |= ActivityFlags.LaunchAdjacent | ActivityFlags.NewTask;
else
tabsFlags = ActivityFlags.LaunchAdjacent | ActivityFlags.NewTask;
}
#endif
tabsIntent.Intent.SetFlags(flags);

#if __ANDROID_25__
tabsIntent.LaunchUrl(Platform.AppContext, nativeUri);
#else
tabsIntent.LaunchUrl(Platform.GetCurrentActivity(true), nativeUri);
#endif
// Check if there's flags specified to use
if (tabsFlags.HasValue)
tabsIntent.Intent.SetFlags(tabsFlags.Value);

tabsIntent.LaunchUrl(context, nativeUri);

break;
case BrowserLaunchMode.External:
var intent = new Intent(Intent.ActionView, nativeUri);
flags = ActivityFlags.ClearTop | ActivityFlags.NewTask;
var flags = ActivityFlags.ClearTop | ActivityFlags.NewTask;
#if __ANDROID_24__
if (Platform.HasApiLevelN)
if (Platform.HasApiLevelN && options.HasFlag(BrowserLaunchFlags.LaunchAdjacent))
flags |= ActivityFlags.LaunchAdjacent;
#endif
intent.SetFlags(flags);
Expand Down
Loading

0 comments on commit 2501782

Please sign in to comment.