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

Commit

Permalink
1.5.1 (#1145)
Browse files Browse the repository at this point in the history
* 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 <janus@gcc.gnu.org>
Co-authored-by: James Montemagno <james.montemagno@gmail.com>
Co-authored-by: Michael <Michael@ZPF.fr>
  • Loading branch information
4 people committed Mar 3, 2020
1 parent 634e74f commit d09c637
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
5 changes: 4 additions & 1 deletion Xamarin.Essentials/AppInfo/AppInfo.ios.tvos.watchos.cs
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Essentials/Launcher/Launcher.shared.cs
Expand Up @@ -56,7 +56,7 @@ public static Task<bool> TryOpenAsync(Uri uri)
if (uri == null)
throw new ArgumentNullException(nameof(uri));

return PlatformCanOpenAsync(uri);
return PlatformTryOpenAsync(uri);
}
}

Expand Down
19 changes: 13 additions & 6 deletions Xamarin.Essentials/Permissions/Permissions.android.cs
Expand Up @@ -224,15 +224,22 @@ public partial class LocationWhenInUse : BasePlatformPermission

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
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Essentials/Permissions/Permissions.uwp.cs
Expand Up @@ -27,7 +27,7 @@ public static bool IsCapabilityDeclared(string capabilityName)

public abstract partial class BasePlatformPermission : BasePermission
{
protected virtual Func<IEnumerable<string>> RequiredDeclarations { get; }
protected virtual Func<IEnumerable<string>> RequiredDeclarations { get; } = () => Array.Empty<string>();

public override Task<PermissionStatus> CheckStatusAsync()
{
Expand Down
7 changes: 7 additions & 0 deletions Xamarin.Essentials/Platform/Platform.android.cs
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions Xamarin.Essentials/Xamarin.Essentials.csproj
Expand Up @@ -51,6 +51,7 @@
<None Include="..\Assets\xamarin.essentials_128x128.png" PackagePath="icon.png" Pack="true" />
<None Include="..\nugetreadme.txt" PackagePath="readme.txt" Pack="true" />
<PackageReference Include="mdoc" Version="5.7.4.10" PrivateAssets="All" />
<PackageReference Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" />
<Compile Include="**\*.shared.cs" />
<Compile Include="**\*.shared.*.cs" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion docs/en/Xamarin.Essentials/PlacemarkExtensions.xml
Expand Up @@ -11,7 +11,7 @@
</Base>
<Interfaces />
<Docs>
<summary>Extensions for the palcemark.</summary>
<summary>Extensions for the placemark.</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
Expand Down

0 comments on commit d09c637

Please sign in to comment.