Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Xamarin.Essentials/AppInfo/AppInfo.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
using Android.Content.PM;
using Android.Content.Res;
using Android.Provider;
#if __ANDROID_29__
using AndroidX.Core.Content.PM;
#else
using Android.Support.V4.Content.PM;
#endif

namespace Xamarin.Essentials
{
Expand Down Expand Up @@ -33,7 +38,13 @@ static string PlatformGetBuild()
var packageName = Platform.AppContext.PackageName;
using (var info = pm.GetPackageInfo(packageName, PackageInfoFlags.MetaData))
{
#if __ANDROID_28__
return PackageInfoCompat.GetLongVersionCode(info).ToString(CultureInfo.InvariantCulture);
#else
#pragma warning disable CS0618 // Type or member is obsolete
return info.VersionCode.ToString(CultureInfo.InvariantCulture);
#pragma warning restore CS0618 // Type or member is obsolete
#endif
}
}

Expand Down
2 changes: 2 additions & 0 deletions Xamarin.Essentials/Permissions/Permissions.macos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public override Task<PermissionStatus> CheckStatusAsync() =>
public override Task<PermissionStatus> RequestAsync() =>
Task.FromResult(PermissionStatus.Granted);

public override bool ShouldShowRationale() => false;

public override void EnsureDeclared()
{
var plistKeys = RequiredInfoPlistKeys?.Invoke();
Expand Down
8 changes: 8 additions & 0 deletions Xamarin.Essentials/Platform/Platform.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ internal static Java.Util.Locale GetLocale()
return config.Locales.Get(0);
#endif

#pragma warning disable CS0618 // Type or member is obsolete
return config.Locale;
#pragma warning restore CS0618 // Type or member is obsolete
}

internal static void SetLocale(Java.Util.Locale locale)
Expand All @@ -231,9 +233,15 @@ internal static void SetLocale(Java.Util.Locale locale)
var config = resources.Configuration;

if (HasApiLevelN)
{
config.SetLocale(locale);
}
else
{
#pragma warning disable CS0618 // Type or member is obsolete
config.Locale = locale;
#pragma warning restore CS0618 // Type or member is obsolete
}

#pragma warning disable CS0618 // Type or member is obsolete
resources.UpdateConfiguration(config, resources.DisplayMetrics);
Expand Down