From d09c637c6ab43448e99b79647a08b66f74faf7f7 Mon Sep 17 00:00:00 2001 From: Jonathan Dick Date: Tue, 3 Mar 2020 17:58:18 -0500 Subject: [PATCH 01/17] 1.5.1 (#1145) * Implement vertical accuracy in GeoLocation API (#1103) * Location: add property 'VerticalAccuracy' (#1099) * vertical accuracy is only available in Android API level 26 and above (#1099) * update Samples app to show vertical accuracy on GeolocationPage * add missing documentation bits for Location.VerticalAccuracy * .gitattributes: get better diff context for C# code (#1115) * Location.VerticalAccuracy: add runtime check for Android version (#1099) (#1116) * the compile-time check is not enough * it crashed on old Android versions (<8.0) * GH-1102 Fix launcher on older devices (#1120) * Update Launcher.ios.tvos.cs * OpenUrlAsync was introduced in iOS 10 not 12 https://docs.microsoft.com/en-us/dotnet/api/uikit.uiapplication.openurlasync?view=xamarin-ios-sdk-12 * Fix trailing whitespace * Really? fix whitespace * Really! Fix whitespace * Fixes #1129 - set empty required declarations on UWP (#1133) * Fixes #1129 - set empty required declarations on UWP * Update Permissions.uwp.cs * Update Xamarin.Essentials.csproj (#1136) * GH-1142 AccessBackgroundLocation only when compile & running Q (#1143) * AccessBackgroundLocation only when compile & running Q * put if compile check around permission * GH-1121 If VC is null use TraitCollection (#1144) * Fixes #1123 (#1126) * Update PlacemarkExtensions.xml (#1132) Co-authored-by: Janus Weil Co-authored-by: James Montemagno Co-authored-by: Michael --- .../AppInfo/AppInfo.ios.tvos.watchos.cs | 5 ++++- .../Launcher/Launcher.shared.cs | 2 +- .../Permissions/Permissions.android.cs | 19 +++++++++++++------ .../Permissions/Permissions.uwp.cs | 2 +- .../Platform/Platform.android.cs | 7 +++++++ Xamarin.Essentials/Xamarin.Essentials.csproj | 1 + .../PlacemarkExtensions.xml | 2 +- 7 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Xamarin.Essentials/AppInfo/AppInfo.ios.tvos.watchos.cs b/Xamarin.Essentials/AppInfo/AppInfo.ios.tvos.watchos.cs index 62332f287..263c42338 100644 --- a/Xamarin.Essentials/AppInfo/AppInfo.ios.tvos.watchos.cs +++ b/Xamarin.Essentials/AppInfo/AppInfo.ios.tvos.watchos.cs @@ -30,7 +30,10 @@ static AppTheme PlatformRequestedTheme() if (!Platform.HasOSVersion(13, 0)) return AppTheme.Unspecified; - return Platform.GetCurrentViewController().TraitCollection.UserInterfaceStyle switch + var uiStyle = Platform.GetCurrentUIViewController()?.TraitCollection?.UserInterfaceStyle ?? + UITraitCollection.CurrentTraitCollection.UserInterfaceStyle; + + return uiStyle switch { UIUserInterfaceStyle.Light => AppTheme.Light, UIUserInterfaceStyle.Dark => AppTheme.Dark, diff --git a/Xamarin.Essentials/Launcher/Launcher.shared.cs b/Xamarin.Essentials/Launcher/Launcher.shared.cs index f7aa5a166..3ad9a6b39 100644 --- a/Xamarin.Essentials/Launcher/Launcher.shared.cs +++ b/Xamarin.Essentials/Launcher/Launcher.shared.cs @@ -56,7 +56,7 @@ public static Task TryOpenAsync(Uri uri) if (uri == null) throw new ArgumentNullException(nameof(uri)); - return PlatformCanOpenAsync(uri); + return PlatformTryOpenAsync(uri); } } diff --git a/Xamarin.Essentials/Permissions/Permissions.android.cs b/Xamarin.Essentials/Permissions/Permissions.android.cs index 59fbb843d..57f0ec17c 100644 --- a/Xamarin.Essentials/Permissions/Permissions.android.cs +++ b/Xamarin.Essentials/Permissions/Permissions.android.cs @@ -224,15 +224,22 @@ public override (string androidPermission, bool isRuntime)[] RequiredPermissions public partial class LocationAlways : BasePlatformPermission { - public override (string androidPermission, bool isRuntime)[] RequiredPermissions => - new (string, bool)[] + public override (string androidPermission, bool isRuntime)[] RequiredPermissions + { + get { + var permissions = new List<(string, bool)>(); #if __ANDROID_29__ - (Manifest.Permission.AccessBackgroundLocation, true), + if (Platform.HasApiLevelQ) + permissions.Add((Manifest.Permission.AccessBackgroundLocation, true)); #endif - (Manifest.Permission.AccessCoarseLocation, true), - (Manifest.Permission.AccessFineLocation, true) - }; + + permissions.Add((Manifest.Permission.AccessCoarseLocation, true)); + permissions.Add((Manifest.Permission.AccessFineLocation, true)); + + return permissions.ToArray(); + } + } } public partial class Maps : BasePlatformPermission diff --git a/Xamarin.Essentials/Permissions/Permissions.uwp.cs b/Xamarin.Essentials/Permissions/Permissions.uwp.cs index aa3d5db08..772b4d5a1 100644 --- a/Xamarin.Essentials/Permissions/Permissions.uwp.cs +++ b/Xamarin.Essentials/Permissions/Permissions.uwp.cs @@ -27,7 +27,7 @@ public static bool IsCapabilityDeclared(string capabilityName) public abstract partial class BasePlatformPermission : BasePermission { - protected virtual Func> RequiredDeclarations { get; } + protected virtual Func> RequiredDeclarations { get; } = () => Array.Empty(); public override Task CheckStatusAsync() { diff --git a/Xamarin.Essentials/Platform/Platform.android.cs b/Xamarin.Essentials/Platform/Platform.android.cs index e0e53fcbe..9a3f06a21 100644 --- a/Xamarin.Essentials/Platform/Platform.android.cs +++ b/Xamarin.Essentials/Platform/Platform.android.cs @@ -173,6 +173,13 @@ internal static AndroidUri GetShareableFileUri(string filename) false; #endif + internal static bool HasApiLevelQ => +#if __ANDROID_29__ + HasApiLevel(BuildVersionCodes.Q); +#else + false; +#endif + internal static bool HasApiLevel(BuildVersionCodes versionCode) => (int)Build.VERSION.SdkInt >= (int)versionCode; diff --git a/Xamarin.Essentials/Xamarin.Essentials.csproj b/Xamarin.Essentials/Xamarin.Essentials.csproj index 0c9335ab5..84e63d885 100644 --- a/Xamarin.Essentials/Xamarin.Essentials.csproj +++ b/Xamarin.Essentials/Xamarin.Essentials.csproj @@ -51,6 +51,7 @@ + diff --git a/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml b/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml index 9eea797c8..58896fb83 100644 --- a/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml +++ b/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml @@ -11,7 +11,7 @@ - Extensions for the palcemark. + Extensions for the placemark. To be added. From bc3c859280abcbe2329b6a867967f191b1a06dbe Mon Sep 17 00:00:00 2001 From: Ben Askren Date: Fri, 6 Mar 2020 15:32:46 -0500 Subject: [PATCH 02/17] Fixed: Fatal iOS 13 memory leak when using TextToSpeach.SpeekAsync #1112 --- .../TextToSpeech.ios.tvos.watchos.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.tvos.watchos.cs b/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.tvos.watchos.cs index 71c650014..2569a757a 100644 --- a/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.tvos.watchos.cs +++ b/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.tvos.watchos.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -8,14 +9,18 @@ namespace Xamarin.Essentials { public static partial class TextToSpeech { + static readonly Lazy speechSynthesizer = new Lazy(); + internal static Task> PlatformGetLocalesAsync() => Task.FromResult(AVSpeechSynthesisVoice.GetSpeechVoices() .Select(v => new Locale(v.Language, null, v.Language, v.Identifier))); - internal static Task PlatformSpeakAsync(string text, SpeechOptions options, CancellationToken cancelToken = default) + internal static async Task PlatformSpeakAsync(string text, SpeechOptions options, CancellationToken cancelToken = default) { - var speechUtterance = GetSpeechUtterance(text, options); - return SpeakUtterance(speechUtterance, cancelToken); + using (var speechUtterance = GetSpeechUtterance(text, options)) + { + await SpeakUtterance(speechUtterance, cancelToken); + } } static AVSpeechUtterance GetSpeechUtterance(string text, SpeechOptions options) @@ -44,11 +49,10 @@ static AVSpeechUtterance GetSpeechUtterance(string text, SpeechOptions options) internal static async Task SpeakUtterance(AVSpeechUtterance speechUtterance, CancellationToken cancelToken) { var tcsUtterance = new TaskCompletionSource(); - var speechSynthesizer = new AVSpeechSynthesizer(); try { - speechSynthesizer.DidFinishSpeechUtterance += OnFinishedSpeechUtterance; - speechSynthesizer.SpeakUtterance(speechUtterance); + speechSynthesizer.Value.DidFinishSpeechUtterance += OnFinishedSpeechUtterance; + speechSynthesizer.Value.SpeakUtterance(speechUtterance); using (cancelToken.Register(TryCancel)) { await tcsUtterance.Task; @@ -56,12 +60,12 @@ internal static async Task SpeakUtterance(AVSpeechUtterance speechUtterance, Can } finally { - speechSynthesizer.DidFinishSpeechUtterance -= OnFinishedSpeechUtterance; + speechSynthesizer.Value.DidFinishSpeechUtterance -= OnFinishedSpeechUtterance; } void TryCancel() { - speechSynthesizer?.StopSpeaking(AVSpeechBoundary.Word); + speechSynthesizer.Value?.StopSpeaking(AVSpeechBoundary.Word); tcsUtterance?.TrySetResult(true); } From b6fe59a67531232f5a213af8fede499d13fd214a Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Wed, 11 Mar 2020 13:48:26 -0700 Subject: [PATCH 03/17] Check if 4th value is present in orienation sensor --- .../OrientationSensor.android.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Xamarin.Essentials/OrientationSensor/OrientationSensor.android.cs b/Xamarin.Essentials/OrientationSensor/OrientationSensor.android.cs index 1ff995a88..f2eca3745 100644 --- a/Xamarin.Essentials/OrientationSensor/OrientationSensor.android.cs +++ b/Xamarin.Essentials/OrientationSensor/OrientationSensor.android.cs @@ -43,11 +43,21 @@ void ISensorEventListener.OnAccuracyChanged(Sensor sensor, [GeneratedEnum] Senso void ISensorEventListener.OnSensorChanged(SensorEvent e) { - if ((e?.Values?.Count ?? 0) < 4) + var count = e?.Values?.Count ?? 0; + if (count < 3) return; - var data = new OrientationSensorData(e.Values[0], e.Values[1], e.Values[2], e.Values[3]); - OrientationSensor.OnChanged(data); + OrientationSensorData? data; + + // Docs: https://developer.android.com/reference/android/hardware/SensorEvent#sensor.type_rotation_vector-: + // values[3], originally optional, will always be present from SDK Level 18 onwards. values[4] is a new value that has been added in SDK Level 18. + + if (count < 4) + data = new OrientationSensorData(e.Values[0], e.Values[1], e.Values[2], -1); + else + data = new OrientationSensorData(e.Values[0], e.Values[1], e.Values[2], e.Values[3]); + + OrientationSensor.OnChanged(data.Value); } } } From 59d537ac25991990a170984ff8ee5162e148224a Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Thu, 12 Mar 2020 11:08:35 -0700 Subject: [PATCH 04/17] GH-1158 Remove configure await false, needs to be on main thread. --- Xamarin.Essentials/Launcher/Launcher.android.cs | 4 ++-- Xamarin.Essentials/Launcher/Launcher.tizen.cs | 4 ++-- Xamarin.Essentials/Launcher/Launcher.uwp.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Xamarin.Essentials/Launcher/Launcher.android.cs b/Xamarin.Essentials/Launcher/Launcher.android.cs index 5dbeb4791..c2545223a 100644 --- a/Xamarin.Essentials/Launcher/Launcher.android.cs +++ b/Xamarin.Essentials/Launcher/Launcher.android.cs @@ -59,10 +59,10 @@ static Task PlatformOpenAsync(OpenFileRequest request) static async Task PlatformTryOpenAsync(Uri uri) { - var canOpen = await PlatformCanOpenAsync(uri).ConfigureAwait(false); + var canOpen = await PlatformCanOpenAsync(uri); if (canOpen) - await PlatformOpenAsync(uri).ConfigureAwait(false); + await PlatformOpenAsync(uri); return canOpen; } diff --git a/Xamarin.Essentials/Launcher/Launcher.tizen.cs b/Xamarin.Essentials/Launcher/Launcher.tizen.cs index b3eaf9b37..df35c2bff 100644 --- a/Xamarin.Essentials/Launcher/Launcher.tizen.cs +++ b/Xamarin.Essentials/Launcher/Launcher.tizen.cs @@ -57,10 +57,10 @@ static Task PlatformOpenAsync(OpenFileRequest request) static async Task PlatformTryOpenAsync(Uri uri) { - var canOpen = await PlatformCanOpenAsync(uri).ConfigureAwait(false); + var canOpen = await PlatformCanOpenAsync(uri); if (canOpen) - await PlatformOpenAsync(uri).ConfigureAwait(false); + await PlatformOpenAsync(uri); return canOpen; } diff --git a/Xamarin.Essentials/Launcher/Launcher.uwp.cs b/Xamarin.Essentials/Launcher/Launcher.uwp.cs index a1ec0f9a4..8f6b61af4 100644 --- a/Xamarin.Essentials/Launcher/Launcher.uwp.cs +++ b/Xamarin.Essentials/Launcher/Launcher.uwp.cs @@ -27,10 +27,10 @@ static async Task PlatformOpenAsync(OpenFileRequest request) static async Task PlatformTryOpenAsync(Uri uri) { - var canOpen = await PlatformCanOpenAsync(uri).ConfigureAwait(false); + var canOpen = await PlatformCanOpenAsync(uri); if (canOpen) - return await WinLauncher.LaunchUriAsync(uri).AsTask().ConfigureAwait(false); + return await WinLauncher.LaunchUriAsync(uri).AsTask(); return canOpen; } From 48763efc89ec1753220ef2096e4d065eb7275413 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Thu, 12 Mar 2020 12:18:54 -0700 Subject: [PATCH 05/17] Update latest nugets --- .../DeviceTests.Shared.csproj | 2 +- .../DeviceTests.UWP/DeviceTests.UWP.csproj | 2 +- .../Sample.Server.WebAuthenticator.csproj | 12 ++++----- .../Resources/values/styles.xml | 4 +-- .../Samples.Android/Samples.Android.csproj | 25 ++++++++---------- Samples/Samples.UWP/Samples.UWP.csproj | 26 +++++++++---------- Samples/Samples.iOS/Samples.iOS.csproj | 12 ++++----- Samples/Samples/Samples.csproj | 12 ++++----- Xamarin.Essentials/Xamarin.Essentials.csproj | 2 +- 9 files changed, 47 insertions(+), 50 deletions(-) diff --git a/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj b/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj index 42c34dea1..fd15dda89 100644 --- a/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj +++ b/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj @@ -31,7 +31,7 @@ - + Windows Mobile Extensions for the UWP diff --git a/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj b/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj index c94986fff..5fd16a1d1 100644 --- a/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj +++ b/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj @@ -115,7 +115,7 @@ - + diff --git a/Samples/Sample.Server.WebAuthenticator/Sample.Server.WebAuthenticator.csproj b/Samples/Sample.Server.WebAuthenticator/Sample.Server.WebAuthenticator.csproj index b8fc2b984..1615b2910 100644 --- a/Samples/Sample.Server.WebAuthenticator/Sample.Server.WebAuthenticator.csproj +++ b/Samples/Sample.Server.WebAuthenticator/Sample.Server.WebAuthenticator.csproj @@ -1,16 +1,16 @@ - netcoreapp3.0 + netcoreapp3.1 - - - - - + + + + + diff --git a/Samples/Samples.Android/Resources/values/styles.xml b/Samples/Samples.Android/Resources/values/styles.xml index d5bf90631..01fa0dcba 100644 --- a/Samples/Samples.Android/Resources/values/styles.xml +++ b/Samples/Samples.Android/Resources/values/styles.xml @@ -5,7 +5,7 @@ - - diff --git a/Samples/Samples.Android/Samples.Android.csproj b/Samples/Samples.Android/Samples.Android.csproj index dc52c2fa4..17e189237 100644 --- a/Samples/Samples.Android/Samples.Android.csproj +++ b/Samples/Samples.Android/Samples.Android.csproj @@ -29,6 +29,10 @@ prompt 4 None + false + false + false + false true @@ -54,22 +58,15 @@ - - - - + + + + - - - - - - - - - + + - + diff --git a/Samples/Samples.UWP/Samples.UWP.csproj b/Samples/Samples.UWP/Samples.UWP.csproj index 2a053431b..9e849cb12 100644 --- a/Samples/Samples.UWP/Samples.UWP.csproj +++ b/Samples/Samples.UWP/Samples.UWP.csproj @@ -11,7 +11,7 @@ Samples.UWP en-US UAP - 10.0.16299.0 + 10.0.18362.0 10.0.16299.0 14 true @@ -115,20 +115,15 @@ true - - - - - - - + + + + + + + - - - Windows Mobile Extensions for the UWP - - {63a4f6a1-48bf-4d32-aed7-82f605edb042} @@ -199,6 +194,11 @@ + + + Windows Mobile Extensions for the UWP + + 14.0 diff --git a/Samples/Samples.iOS/Samples.iOS.csproj b/Samples/Samples.iOS/Samples.iOS.csproj index f70a25323..cb65cce8f 100644 --- a/Samples/Samples.iOS/Samples.iOS.csproj +++ b/Samples/Samples.iOS/Samples.iOS.csproj @@ -72,12 +72,12 @@ - - - - - - + + + + + + diff --git a/Samples/Samples/Samples.csproj b/Samples/Samples/Samples.csproj index 970b8eaff..fdf05730e 100644 --- a/Samples/Samples/Samples.csproj +++ b/Samples/Samples/Samples.csproj @@ -11,12 +11,12 @@ - - - - - - + + + + + + diff --git a/Xamarin.Essentials/Xamarin.Essentials.csproj b/Xamarin.Essentials/Xamarin.Essentials.csproj index 84e63d885..36b567f3b 100644 --- a/Xamarin.Essentials/Xamarin.Essentials.csproj +++ b/Xamarin.Essentials/Xamarin.Essentials.csproj @@ -64,7 +64,7 @@ - + From 06ae54248eeb7f6ff5d5e4d8da51d59081e09f1b Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Thu, 12 Mar 2020 13:06:11 -0700 Subject: [PATCH 06/17] Fix CheckStatus for Battery Permission on Android --- Xamarin.Essentials/Permissions/Permissions.android.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Xamarin.Essentials/Permissions/Permissions.android.cs b/Xamarin.Essentials/Permissions/Permissions.android.cs index fcb2f7300..cbed73cc0 100644 --- a/Xamarin.Essentials/Permissions/Permissions.android.cs +++ b/Xamarin.Essentials/Permissions/Permissions.android.cs @@ -166,6 +166,9 @@ public partial class Battery : BasePlatformPermission { public override (string androidPermission, bool isRuntime)[] RequiredPermissions => new (string, bool)[] { (Manifest.Permission.BatteryStats, false) }; + + public override Task CheckStatusAsync() => + Task.FromResult(IsDeclaredInManifest(Manifest.Permission.BatteryStats) ? PermissionStatus.Granted : PermissionStatus.Denied); } public partial class CalendarRead : BasePlatformPermission From b6198a3511511b64ef80d96daa28cc2bdb458e64 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Tue, 17 Mar 2020 15:55:20 -0700 Subject: [PATCH 07/17] Link in release simualtor mode for testing --- Samples/Samples.iOS/Samples.iOS.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Samples/Samples.iOS/Samples.iOS.csproj b/Samples/Samples.iOS/Samples.iOS.csproj index f70a25323..cafe811da 100644 --- a/Samples/Samples.iOS/Samples.iOS.csproj +++ b/Samples/Samples.iOS/Samples.iOS.csproj @@ -33,8 +33,9 @@ bin\iPhoneSimulator\Release prompt 4 - None + Full x86_64 + --linkskip=Xamarin.Forms.Platform.iOS --linkskip=Xamarin.Forms.Platform --linkskip=Xamarin.Forms.Core --linkskip=Xamarin.Forms.Xaml --linkskip=Samples true From 2a0711b1ba27e6bcc1f163d482aa76655c87bd0c Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Wed, 18 Mar 2020 17:48:07 -0700 Subject: [PATCH 08/17] Add check to encode number only when there is an extension. --- Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs b/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs index 68a1aa6fd..398c30eb4 100644 --- a/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs +++ b/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs @@ -41,7 +41,9 @@ static void PlatformOpen(string number) phoneNumber = PhoneNumberUtils.FormatNumber(number); #pragma warning restore CS0618 - phoneNumber = URLEncoder.Encode(phoneNumber, "UTF-8"); + // if we are an extension then we need to encode + if (phoneNumber.Contains(",") || phoneNumber.Contains(";")) + phoneNumber = URLEncoder.Encode(phoneNumber, "UTF-8"); var dialIntent = ResolveDialIntent(phoneNumber); From 9195d1d5afad7b7532f5e425fdef05d060aa76a1 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Wed, 18 Mar 2020 21:12:03 -0700 Subject: [PATCH 09/17] Update PhoneDialer.android.cs --- Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs b/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs index 398c30eb4..4a7d0190a 100644 --- a/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs +++ b/Xamarin.Essentials/PhoneDialer/PhoneDialer.android.cs @@ -42,7 +42,7 @@ static void PlatformOpen(string number) #pragma warning restore CS0618 // if we are an extension then we need to encode - if (phoneNumber.Contains(",") || phoneNumber.Contains(";")) + if (phoneNumber.Contains(',') || phoneNumber.Contains(';')) phoneNumber = URLEncoder.Encode(phoneNumber, "UTF-8"); var dialIntent = ResolveDialIntent(phoneNumber); From 43096d77286e8c3fe6b6f180dfb71554954b8830 Mon Sep 17 00:00:00 2001 From: Jonathan Dick Date: Thu, 19 Mar 2020 16:12:15 -0400 Subject: [PATCH 10/17] Added default auth scheme to asp.net sample --- Samples/Sample.Server.WebAuthenticator/Startup.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Samples/Sample.Server.WebAuthenticator/Startup.cs b/Samples/Sample.Server.WebAuthenticator/Startup.cs index 2a6331b5d..3c0417ec4 100644 --- a/Samples/Sample.Server.WebAuthenticator/Startup.cs +++ b/Samples/Sample.Server.WebAuthenticator/Startup.cs @@ -29,7 +29,10 @@ public void ConfigureServices(IServiceCollection services) { services.AddControllers(); - services.AddAuthentication() + services.AddAuthentication(o => + { + o.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; + }) .AddCookie() .AddFacebook(fb => { From bf37f5d34d4d309533968a87efa517de041a96f9 Mon Sep 17 00:00:00 2001 From: Jonathan Dick Date: Thu, 19 Mar 2020 16:29:30 -0400 Subject: [PATCH 11/17] Cache Android SdkInt at runtime This should never ever change at runtime, so should be safe to cache. --- Xamarin.Essentials/Platform/Platform.android.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Xamarin.Essentials/Platform/Platform.android.cs b/Xamarin.Essentials/Platform/Platform.android.cs index 9a3f06a21..67baf45d9 100644 --- a/Xamarin.Essentials/Platform/Platform.android.cs +++ b/Xamarin.Essentials/Platform/Platform.android.cs @@ -180,8 +180,15 @@ internal static AndroidUri GetShareableFileUri(string filename) false; #endif + static int? sdkInt; + + internal static int SdkInt + => sdkInt.HasValue + ? sdkInt.Value + : (sdkInt = (int)Build.VERSION.SdkInt).Value; + internal static bool HasApiLevel(BuildVersionCodes versionCode) => - (int)Build.VERSION.SdkInt >= (int)versionCode; + SdkInt >= (int)versionCode; internal static CameraManager CameraManager => AppContext.GetSystemService(Context.CameraService) as CameraManager; From fe1febd7e570806a5439ea8041cd7ac0844c397c Mon Sep 17 00:00:00 2001 From: Jonathan Dick Date: Thu, 19 Mar 2020 16:32:34 -0400 Subject: [PATCH 12/17] Nicer syntax --- Xamarin.Essentials/Platform/Platform.android.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Xamarin.Essentials/Platform/Platform.android.cs b/Xamarin.Essentials/Platform/Platform.android.cs index 67baf45d9..2c085d9e6 100644 --- a/Xamarin.Essentials/Platform/Platform.android.cs +++ b/Xamarin.Essentials/Platform/Platform.android.cs @@ -183,9 +183,7 @@ internal static AndroidUri GetShareableFileUri(string filename) static int? sdkInt; internal static int SdkInt - => sdkInt.HasValue - ? sdkInt.Value - : (sdkInt = (int)Build.VERSION.SdkInt).Value; + => sdkInt ?? (sdkInt = (int)Build.VERSION.SdkInt).Value; internal static bool HasApiLevel(BuildVersionCodes versionCode) => SdkInt >= (int)versionCode; From e5636d3ed521d8f4769d4f75ca9286301b8bb735 Mon Sep 17 00:00:00 2001 From: Jonathan Dick Date: Thu, 19 Mar 2020 21:21:47 -0400 Subject: [PATCH 13/17] Added missing ns --- Samples/Sample.Server.WebAuthenticator/Startup.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Samples/Sample.Server.WebAuthenticator/Startup.cs b/Samples/Sample.Server.WebAuthenticator/Startup.cs index 3c0417ec4..ee5827070 100644 --- a/Samples/Sample.Server.WebAuthenticator/Startup.cs +++ b/Samples/Sample.Server.WebAuthenticator/Startup.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.AspNetCore.Authentication.Cookies; namespace Sample.Server.WebAuthenticator { From 54c4445fca34b46e225aae90840550f182f4e361 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Fri, 20 Mar 2020 10:53:03 -0600 Subject: [PATCH 14/17] Update Xamarin.Essentials/Platform/Platform.android.cs Co-Authored-By: Matthew Leibowitz --- Xamarin.Essentials/Platform/Platform.android.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Xamarin.Essentials/Platform/Platform.android.cs b/Xamarin.Essentials/Platform/Platform.android.cs index 2c085d9e6..7a1e830de 100644 --- a/Xamarin.Essentials/Platform/Platform.android.cs +++ b/Xamarin.Essentials/Platform/Platform.android.cs @@ -183,7 +183,7 @@ internal static AndroidUri GetShareableFileUri(string filename) static int? sdkInt; internal static int SdkInt - => sdkInt ?? (sdkInt = (int)Build.VERSION.SdkInt).Value; + => sdkInt ??= (int)Build.VERSION.SdkInt; internal static bool HasApiLevel(BuildVersionCodes versionCode) => SdkInt >= (int)versionCode; From a2f3e4403e06ea4c42811835353f48066bce34b1 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Sat, 21 Mar 2020 15:39:15 -0600 Subject: [PATCH 15/17] Fix ordering for build! (#1186) --- Samples/Sample.Server.WebAuthenticator/Startup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Samples/Sample.Server.WebAuthenticator/Startup.cs b/Samples/Sample.Server.WebAuthenticator/Startup.cs index ee5827070..cfd45d086 100644 --- a/Samples/Sample.Server.WebAuthenticator/Startup.cs +++ b/Samples/Sample.Server.WebAuthenticator/Startup.cs @@ -2,13 +2,13 @@ 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; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.AspNetCore.Authentication.Cookies; namespace Sample.Server.WebAuthenticator { From 89c46af064d7780dbce7081c914b86c943387676 Mon Sep 17 00:00:00 2001 From: Brad Dean Date: Sat, 21 Mar 2020 18:51:07 -0400 Subject: [PATCH 16/17] Update AppInfo.xml (#1181) --- docs/en/Xamarin.Essentials/AppInfo.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Xamarin.Essentials/AppInfo.xml b/docs/en/Xamarin.Essentials/AppInfo.xml index 54df6f2e4..c3a7451f8 100644 --- a/docs/en/Xamarin.Essentials/AppInfo.xml +++ b/docs/en/Xamarin.Essentials/AppInfo.xml @@ -72,7 +72,7 @@ Gets the application package name or identifier. The package name or identifier. - On android and iOS, this is the application package name. On UWP, this is the application GUID. + On Android and iOS, this is the application package name. On UWP, this is the application GUID. From 945f5a2bbd4fb7decc51e9204af2b3f163c0166d Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Sun, 22 Mar 2020 17:11:50 +0100 Subject: [PATCH 17/17] Location.Altitude: update the documentation regarding platform-specific reference systems * see issue #1177 * also mention altitude in Location summary * and fix a typo --- docs/en/Xamarin.Essentials/Location.xml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/en/Xamarin.Essentials/Location.xml b/docs/en/Xamarin.Essentials/Location.xml index f548aa33f..3c2de50db 100644 --- a/docs/en/Xamarin.Essentials/Location.xml +++ b/docs/en/Xamarin.Essentials/Location.xml @@ -11,7 +11,7 @@ - The latitude, longitude, and time information reported by the device. + The latitude, longitude, altitude and time information reported by the device. @@ -133,9 +133,14 @@ System.Nullable<System.Double> - Gets the Altitude, if available in meters above sea level. - Altidude of location if available. - Returns 0 or no value if not available. + Gets the altitude in meters (if available). The reference system is platform specific. + Altitude of location if available. + + Returns 0 or no value if not available. The reference system is different for each platform: + - Android: Altitude is returned in meters above the WGS 84 reference ellipsoid. If this location does not have an altitude then 0.0 is returned. + - iOS: Altitude is returned in meters above mean sea level (MSL, parametrized by a geoid). + - UWP: Altitude can be returned in different reference systems. See Windows.Devices.Geolocation.Geopoint.AltitudeReferenceSystem. +