Merge branch 'develop' into 1.6.0

This commit is contained in:
Jonathan Dick 2020-07-20 10:11:35 -04:00
Родитель f30a865c8c 94717ca755
Коммит 85af2464b3
47 изменённых файлов: 587 добавлений и 74 удалений

Просмотреть файл

@ -87,7 +87,7 @@ Every pull request which affects public types or members should include correspo
If you're looking for something to fix, please browse [open issues](https://github.com/xamarin/Essentials/issues).
Follow the style used by the [.NET Foundation](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md), with two primary exceptions:
Follow the style used by the [.NET Foundation](https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/coding-style.md), with two primary exceptions:
- We do not use the `private` keyword as it is the default accessibility level in C#.
- We will **not** use `_` or `s_` as a prefix for internal or private field names

Просмотреть файл

@ -0,0 +1,15 @@
using System;
using Xamarin.Essentials;
using Xunit;
namespace DeviceTests
{
public class HapticFeedback_Tests
{
[Fact]
public void Click() => HapticFeedback.Perform(HapticFeedbackType.Click);
[Fact]
public void LongPress() => HapticFeedback.Perform(HapticFeedbackType.LongPress);
}
}

Просмотреть файл

@ -31,13 +31,18 @@ namespace Sample.Server.WebAuthenticator
}
else
{
var claims = auth.Principal.Identities.FirstOrDefault()?.Claims;
var email = string.Empty;
email = claims?.FirstOrDefault(c => c.Type == System.Security.Claims.ClaimTypes.Email)?.Value;
// Get parameters to send back to the callback
var qs = new Dictionary<string, string>
{
{ "access_token", auth.Properties.GetTokenValue("access_token") },
{ "refresh_token", auth.Properties.GetTokenValue("refresh_token") ?? string.Empty },
{ "expires", (auth.Properties.ExpiresUtc?.ToUnixTimeSeconds() ?? -1).ToString() }
};
{
{ "access_token", auth.Properties.GetTokenValue("access_token") },
{ "refresh_token", auth.Properties.GetTokenValue("refresh_token") ?? string.Empty },
{ "expires", (auth.Properties.ExpiresUtc?.ToUnixTimeSeconds() ?? -1).ToString() },
{ "email", email }
};
// Build the result url
var url = callbackScheme + "://#" + string.Join(

Просмотреть файл

@ -62,6 +62,13 @@ namespace Sample.Server.WebAuthenticator
=> WebHostEnvironment.ContentRootFileProvider.GetFileInfo($"AuthKey_{keyId}.p8"));
a.SaveTokens = true;
});
/*
* For Apple signin
* If you are running the app on Azure you must add the Configuration setting
* WEBSITE_LOAD_USER_PROFILE = 1
* Without this setting you will get a File Not Found exception when AppleAuthenticationHandler tries to generate a certificate using your Auth_{keyId].P8 file.
*/
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

Просмотреть файл

@ -44,7 +44,7 @@
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidSupportedAbis>armeabi-v7a;x86</AndroidSupportedAbis>
<EnableProguard>true</EnableProguard>
<AndroidLinkTool>r8</AndroidLinkTool>
<AndroidLinkMode>Full</AndroidLinkMode>
<AndroidLinkSkip>Xamarin.Forms.Platform.Android;Xamarin.Forms.Platform;Xamarin.Forms.Core;Xamarin.Forms.Xaml;Samples;FormsViewGroup;</AndroidLinkSkip>
</PropertyGroup>
@ -123,4 +123,4 @@
<AndroidAsset Include="Assets\FileSystemTemplate.txt" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
</Project>

Просмотреть файл

@ -0,0 +1,24 @@
<views:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Samples.View"
xmlns:viewmodels="clr-namespace:Samples.ViewModel"
x:Class="Samples.View.HapticFeedbackPage"
Title="Vibration">
<views:BasePage.BindingContext>
<viewmodels:HapticFeedbackViewModel />
</views:BasePage.BindingContext>
<StackLayout>
<Label Text="Quickly and easily make the device provide haptic feedback." FontAttributes="Bold" Margin="12" />
<ScrollView>
<StackLayout Padding="12,0,12,12" Spacing="6">
<Button Text="Click" Command="{Binding ClickCommand}" />
<Button Text="LongPress" Command="{Binding LongPressCommand}" />
<Label Text="HapticFeadback is not supported." TextColor="Red" FontAttributes="Italic"
IsVisible="{Binding IsSupported, Converter={StaticResource NegativeConverter}}" />
</StackLayout>
</ScrollView>
</StackLayout>
</views:BasePage>

Просмотреть файл

@ -0,0 +1,10 @@
namespace Samples.View
{
public partial class HapticFeedbackPage : BasePage
{
public HapticFeedbackPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,60 @@
using System;
using System.Windows.Input;
using Xamarin.Essentials;
using Xamarin.Forms;
namespace Samples.ViewModel
{
public class HapticFeedbackViewModel : BaseViewModel
{
bool isSupported = true;
public HapticFeedbackViewModel()
{
ClickCommand = new Command(OnClick);
LongPressCommand = new Command(OnLongPress);
}
public ICommand ClickCommand { get; }
public ICommand LongPressCommand { get; }
public bool IsSupported
{
get => isSupported;
set => SetProperty(ref isSupported, value);
}
void OnClick()
{
try
{
HapticFeedback.Perform(HapticFeedbackType.Click);
}
catch (FeatureNotSupportedException)
{
IsSupported = false;
}
catch (Exception ex)
{
DisplayAlertAsync($"Unable to HapticFeedback: {ex.Message}");
}
}
void OnLongPress()
{
try
{
HapticFeedback.Perform(HapticFeedbackType.LongPress);
}
catch (FeatureNotSupportedException)
{
IsSupported = false;
}
catch (Exception ex)
{
DisplayAlertAsync($"Unable to HapticFeedback: {ex.Message}");
}
}
}
}

Просмотреть файл

@ -204,6 +204,12 @@ namespace Samples.ViewModel
typeof(VibrationPage),
"Quickly and easily make the device vibrate.",
new[] { "vibration", "vibrate", "hardware", "device" }),
new SampleItem(
"📳",
"Haptic Feedback",
typeof(HapticFeedbackPage),
"Quickly and easily make the device provide haptic feedback",
new[] { "haptic", "feedback", "hardware", "device" }),
new SampleItem(
"🔓",
"Web Authenticator",

Просмотреть файл

@ -29,7 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{6330
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{EE4495FA-9869-45CF-A11D-69F2218C6F62}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample.Server.WebAuthenticator", "Samples\Sample.Server.WebAuthenticator\Sample.Server.WebAuthenticator.csproj", "{553D51A8-8E79-40D9-9FB3-9FC2386FF886}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.Server.WebAuthenticator", "Samples\Sample.Server.WebAuthenticator\Sample.Server.WebAuthenticator.csproj", "{553D51A8-8E79-40D9-9FB3-9FC2386FF886}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Mac", "Samples\Samples.Mac\Samples.Mac.csproj", "{89899D16-4BD1-49B1-9903-9F6BB26C5DC5}"
EndProject

Просмотреть файл

@ -34,10 +34,18 @@ namespace Xamarin.Essentials
static Intent CreateIntent(EmailMessage message)
{
var action = message?.Attachments?.Count > 1 ? Intent.ActionSendMultiple : Intent.ActionSend;
var action = (message?.Attachments?.Count ?? 0) switch
{
0 => Intent.ActionSendto,
1 => Intent.ActionSend,
_ => Intent.ActionSendMultiple
};
var intent = new Intent(action);
intent.SetType("message/rfc822");
intent.SetData(Uri.Parse("mailto:")); // only email apps should handle this
if (action == Intent.ActionSendto)
intent.SetData(Uri.Parse("mailto:"));
else
intent.SetType("message/rfc822");
if (!string.IsNullOrEmpty(message?.Body))
{

Просмотреть файл

@ -41,7 +41,7 @@ namespace Xamarin.Essentials
if (!IsSupported)
throw new FeatureNotSupportedException();
await Permissions.RequestAsync<Permissions.Flashlight>();
await Permissions.EnsureGrantedAsync<Permissions.Flashlight>();
}
static Task ToggleTorchAsync(bool switchOn)

Просмотреть файл

@ -19,7 +19,7 @@ namespace Xamarin.Essentials
static async Task<Location> PlatformLastKnownLocationAsync()
{
await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();
var lm = Platform.LocationManager;
AndroidLocation bestLocation = null;
@ -37,7 +37,7 @@ namespace Xamarin.Essentials
static async Task<Location> PlatformLocationAsync(GeolocationRequest request, CancellationToken cancellationToken)
{
await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();
var locationManager = Platform.LocationManager;

Просмотреть файл

@ -14,7 +14,7 @@ namespace Xamarin.Essentials
if (!CLLocationManager.LocationServicesEnabled)
throw new FeatureNotEnabledException("Location services are not enabled on device.");
await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();
var manager = new CLLocationManager();
var location = manager.Location;
@ -27,7 +27,7 @@ namespace Xamarin.Essentials
if (!CLLocationManager.LocationServicesEnabled)
throw new FeatureNotEnabledException("Location services are not enabled on device.");
await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();
// the location manager requires an active run loop
// so just use the main loop

Просмотреть файл

@ -8,16 +8,11 @@ namespace Xamarin.Essentials
{
static Location lastKnownLocation = new Location();
static async Task<Location> PlatformLastKnownLocationAsync()
{
await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
return lastKnownLocation;
}
static Task<Location> PlatformLastKnownLocationAsync() => Task.FromResult(lastKnownLocation);
static async Task<Location> PlatformLocationAsync(GeolocationRequest request, CancellationToken cancellationToken)
{
await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();
Locator service = null;
var gps = Platform.GetFeatureInfo<bool>("location.gps");

Просмотреть файл

@ -25,7 +25,7 @@ namespace Xamarin.Essentials
static async Task<Location> PlatformLocationAsync(GeolocationRequest request, CancellationToken cancellationToken)
{
await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
await Permissions.EnsureGrantedAsync<Permissions.LocationWhenInUse>();
var geolocator = new Geolocator
{

Просмотреть файл

@ -0,0 +1,33 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Android.Views;
namespace Xamarin.Essentials
{
public static partial class HapticFeedback
{
internal static bool IsSupported => true;
static void PlatformPerform(HapticFeedbackType type)
{
Permissions.EnsureDeclared<Permissions.Vibrate>();
try
{
Platform.CurrentActivity?.Window?.DecorView?.PerformHapticFeedback(ConvertType(type));
}
catch (Exception ex)
{
Debug.WriteLine($"HapticFeedback Exception: {ex.Message}");
}
}
static FeedbackConstants ConvertType(HapticFeedbackType type) =>
type switch
{
HapticFeedbackType.LongPress => FeedbackConstants.LongPress,
_ => FeedbackConstants.ContextClick
};
}
}

Просмотреть файл

@ -0,0 +1,46 @@
using System;
using System.Threading.Tasks;
using UIKit;
namespace Xamarin.Essentials
{
public static partial class HapticFeedback
{
internal static bool IsSupported => true;
static void PlatformPerform(HapticFeedbackType type)
{
switch (type)
{
case HapticFeedbackType.LongPress:
PlatformLongPress();
break;
default:
PlatformClick();
break;
}
}
static void PlatformClick()
{
if (Platform.HasOSVersion(10, 0))
{
var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Light);
impact.Prepare();
impact.ImpactOccurred();
impact.Dispose();
}
}
static void PlatformLongPress()
{
if (Platform.HasOSVersion(10, 0))
{
var impact = new UIImpactFeedbackGenerator(UIImpactFeedbackStyle.Medium);
impact.Prepare();
impact.ImpactOccurred();
impact.Dispose();
}
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using System;
using System.Threading.Tasks;
namespace Xamarin.Essentials
{
public static partial class HapticFeedback
{
internal static bool IsSupported
=> throw ExceptionUtils.NotSupportedOrImplementedException;
static void PlatformPerform(HapticFeedbackType type)
=> throw ExceptionUtils.NotSupportedOrImplementedException;
}
}

Просмотреть файл

@ -0,0 +1,14 @@
using System;
namespace Xamarin.Essentials
{
public static partial class HapticFeedback
{
public static void Perform(HapticFeedbackType type = HapticFeedbackType.Click)
{
if (!IsSupported)
throw new FeatureNotSupportedException();
PlatformPerform(type);
}
}
}

Просмотреть файл

@ -0,0 +1,34 @@
using System;
using System.Diagnostics;
using Tizen.System;
namespace Xamarin.Essentials
{
public static partial class HapticFeedback
{
internal static bool IsSupported => true;
static void PlatformPerform(HapticFeedbackType type)
{
Permissions.EnsureDeclared<Permissions.Vibrate>();
try
{
var feedback = new Feedback();
var pattern = ConvertType(type);
if (feedback.IsSupportedPattern(FeedbackType.Vibration, pattern))
feedback.Play(FeedbackType.Vibration, pattern);
}
catch (Exception ex)
{
Debug.WriteLine($"HapticFeedback Exception: {ex.Message}");
}
}
static string ConvertType(HapticFeedbackType type) =>
type switch
{
HapticFeedbackType.LongPress => "Hold",
_ => "Tap"
};
}
}

Просмотреть файл

@ -0,0 +1,54 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Windows.Devices.Haptics;
namespace Xamarin.Essentials
{
public static partial class HapticFeedback
{
const string vibrationDeviceApiType = "Windows.Devices.Haptics.VibrationDevice";
internal static bool IsSupported => true;
static async void PlatformPerform(HapticFeedbackType type)
{
try
{
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent(vibrationDeviceApiType)
&& await VibrationDevice.RequestAccessAsync() == VibrationAccessStatus.Allowed)
{
var controller = (await VibrationDevice.GetDefaultAsync())?.SimpleHapticsController;
if (controller != null)
{
var feedback = FindFeedback(controller, ConvertType(type));
if (feedback != null)
controller.SendHapticFeedback(feedback);
}
}
}
catch (Exception ex)
{
Debug.WriteLine($"HapticFeedback Exception: {ex.Message}");
}
}
static SimpleHapticsControllerFeedback FindFeedback(SimpleHapticsController controller, ushort type)
{
foreach (var feedback in controller.SupportedFeedback)
{
if (feedback.Waveform == type)
return feedback;
}
return null;
}
static ushort ConvertType(HapticFeedbackType type) =>
type switch
{
HapticFeedbackType.LongPress => KnownSimpleHapticsControllerWaveforms.Press,
_ => KnownSimpleHapticsControllerWaveforms.Click
};
}
}

Просмотреть файл

@ -0,0 +1,8 @@
namespace Xamarin.Essentials
{
public enum HapticFeedbackType
{
Click,
LongPress
}
}

Просмотреть файл

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using CoreLocation;
using Foundation;
@ -131,6 +132,9 @@ namespace Xamarin.Essentials
internal static Task<PermissionStatus> RequestLocationAsync(bool whenInUse, Action<CLLocationManager> invokeRequest)
{
if (!CLLocationManager.LocationServicesEnabled)
return Task.FromResult(PermissionStatus.Disabled);
locationManager = new CLLocationManager();
var tcs = new TaskCompletionSource<PermissionStatus>(locationManager);
@ -148,30 +152,51 @@ namespace Xamarin.Essentials
if (e.Status == CLAuthorizationStatus.NotDetermined)
return;
if (previousState == CLAuthorizationStatus.AuthorizedWhenInUse && !whenInUse)
try
{
if (e.Status == CLAuthorizationStatus.AuthorizedWhenInUse)
if (previousState == CLAuthorizationStatus.AuthorizedWhenInUse && !whenInUse)
{
Utils.WithTimeout(tcs.Task, LocationTimeout).ContinueWith(t =>
if (e.Status == CLAuthorizationStatus.AuthorizedWhenInUse)
{
// Wait for a timeout to see if the check is complete
if (!tcs.Task.IsCompleted)
Utils.WithTimeout(tcs.Task, LocationTimeout).ContinueWith(t =>
{
locationManager.AuthorizationChanged -= LocationAuthCallback;
tcs.TrySetResult(GetLocationStatus(whenInUse));
locationManager.Dispose();
locationManager = null;
}
});
return;
try
{
// Wait for a timeout to see if the check is complete
if (tcs != null && !tcs.Task.IsCompleted)
{
locationManager.AuthorizationChanged -= LocationAuthCallback;
tcs.TrySetResult(GetLocationStatus(whenInUse));
}
}
catch (Exception ex)
{
Debug.WriteLine($"Exception processing location permission: {ex.Message}");
tcs?.TrySetException(ex);
}
finally
{
locationManager?.Dispose();
locationManager = null;
}
});
return;
}
}
locationManager.AuthorizationChanged -= LocationAuthCallback;
tcs.TrySetResult(GetLocationStatus(whenInUse));
locationManager?.Dispose();
locationManager = null;
}
catch (Exception ex)
{
Debug.WriteLine($"Exception processing location permission: {ex.Message}");
tcs?.TrySetException(ex);
locationManager?.Dispose();
locationManager = null;
}
locationManager.AuthorizationChanged -= LocationAuthCallback;
tcs.TrySetResult(GetLocationStatus(whenInUse));
locationManager.Dispose();
locationManager = null;
}
}
}

Просмотреть файл

@ -20,6 +20,15 @@ namespace Xamarin.Essentials
where TPermission : BasePermission, new() =>
new TPermission().EnsureDeclared();
internal static async Task EnsureGrantedAsync<TPermission>()
where TPermission : BasePermission, new()
{
var status = await RequestAsync<TPermission>();
if (status != PermissionStatus.Granted)
throw new PermissionException($"{typeof(TPermission).Name} permission was not granted: {status}");
}
public abstract partial class BasePermission
{
[Preserve]

Просмотреть файл

@ -232,6 +232,7 @@ namespace Xamarin.Essentials
var resources = AppContext.Resources;
var config = resources.Configuration;
#if __ANDROID_24__
if (HasApiLevelN)
{
config.SetLocale(locale);

Просмотреть файл

@ -29,7 +29,7 @@ namespace Xamarin.Essentials
{
activityController.PopoverPresentationController.SourceView = vc.View;
if (request.PresentationSourceBounds != Rectangle.Empty)
if (request.PresentationSourceBounds != Rectangle.Empty || Platform.HasOSVersion(13, 0))
activityController.PopoverPresentationController.SourceRect = request.PresentationSourceBounds.ToPlatformRectangle();
}

Просмотреть файл

@ -54,7 +54,7 @@ namespace Xamarin.Essentials
}
}
internal class TextToSpeechImplementation : Java.Lang.Object, AndroidTextToSpeech.IOnInitListener,
class TextToSpeechImplementation : Java.Lang.Object, AndroidTextToSpeech.IOnInitListener,
#pragma warning disable CS0618
AndroidTextToSpeech.IOnUtteranceCompletedListener
#pragma warning restore CS0618
@ -206,7 +206,7 @@ namespace Xamarin.Essentials
.Select(g => g.First());
}
private bool IsLocaleAvailable(JavaLocale l)
bool IsLocaleAvailable(JavaLocale l)
{
try
{

Просмотреть файл

@ -69,7 +69,7 @@ namespace Xamarin.Essentials
void TryCancel()
{
speechSynthesizer.Value?.StopSpeaking(AVSpeechBoundary.Word);
speechSynthesizer.Value?.StopSpeaking(AVSpeechBoundary.Immediate);
tcsUtterance?.TrySetResult(true);
}

Просмотреть файл

@ -44,6 +44,8 @@ namespace Xamarin.Essentials
var appleAccount = new WebAuthenticatorResult();
appleAccount.Properties.Add("id_token", new NSString(creds.IdentityToken, NSStringEncoding.UTF8).ToString());
appleAccount.Properties.Add("authorization_code", new NSString(creds.AuthorizationCode, NSStringEncoding.UTF8).ToString());
appleAccount.Properties.Add("state", creds.State);
appleAccount.Properties.Add("email", creds.Email);
appleAccount.Properties.Add("user_id", creds.User);
appleAccount.Properties.Add("name", NSPersonNameComponentsFormatter.GetLocalizedString(creds.FullName, NSPersonNameComponentsFormatterStyle.Default, NSPersonNameComponentsFormatterOptions.Phonetic));

Просмотреть файл

@ -67,21 +67,21 @@ namespace Xamarin.Essentials
void_objc_msgSend_IntPtr(was.Handle, ObjCRuntime.Selector.GetHandle("setPresentationContextProvider:"), ctx.Handle);
}
was.Start();
var result = await tcsResponse.Task;
was?.Dispose();
was = null;
return result;
using (was)
{
was.Start();
return await tcsResponse.Task;
}
}
if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
{
sf = new SFAuthenticationSession(new NSUrl(url.OriginalString), scheme, AuthSessionCallback);
sf.Start();
var result = await tcsResponse.Task;
sf?.Dispose();
sf = null;
return result;
using (sf)
{
sf.Start();
return await tcsResponse.Task;
}
}
// THis is only on iOS9+ but we only support 10+ in Essentials anyway

Просмотреть файл

@ -25,6 +25,8 @@ namespace Xamarin.Essentials
// For GET requests this is a URI:
var resultUri = new Uri(r.ResponseData.ToString());
return new WebAuthenticatorResult(resultUri);
case WebAuthenticationStatus.UserCancel:
throw new TaskCanceledException();
case WebAuthenticationStatus.ErrorHttp:
throw new UnauthorizedAccessException();
default:

Просмотреть файл

@ -5,8 +5,8 @@
<AssemblyName>Xamarin.Essentials</AssemblyName>
<RootNamespace>Xamarin.Essentials</RootNamespace>
<PackageId>Xamarin.Essentials</PackageId>
<!-- PackageIcon>icon.png</PackageIcon -->
<PackageIconUrl>https://raw.githubusercontent.com/xamarin/Essentials/master/Assets/xamarin.essentials_128x128.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<!-- <PackageIconUrl>https://raw.githubusercontent.com/xamarin/Essentials/master/Assets/xamarin.essentials_128x128.png</PackageIconUrl> -->
<Summary>Xamarin.Essentials: a kit of essential API's for your apps</Summary>
<PackageTags>xamarin, windows, uwp, ios, android, watchos, tvos, tizen, toolkit, xamarin.forms, Xamarin.Essentials, kit</PackageTags>
<Title>Xamarin.Essentials</Title>
@ -74,8 +74,8 @@
<ItemGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
<Compile Include="**\*.android.cs" />
<Compile Include="**\*.android.*.cs" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<Reference Include="System.Numerics"/>
<AndroidResource Include="Resources\xml\*.xml" />
</ItemGroup>
<!-- NOTE: When Android 11.x comes out we neeed to make this check more robust -->
@ -92,22 +92,22 @@
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) ">
<Compile Include="**\*.ios.cs" />
<Compile Include="**\*.ios.*.cs" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<Reference Include="System.Numerics"/>
<Reference Include="OpenTK-1.0" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.TVOS')) ">
<Compile Include="**\*.tvos.cs" />
<Compile Include="**\*.tvos.*.cs" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<Reference Include="System.Numerics"/>
<Reference Include="OpenTK-1.0" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.WatchOS')) ">
<Compile Include="**\*.watchos.cs" />
<Compile Include="**\*.watchos.*.cs" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
<Reference Include="System.Numerics"/>
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('tizen')) ">
<PackageReference Include="Tizen.NET" Version="4.0.0" PrivateAssets="All" />

Просмотреть файл

@ -421,6 +421,13 @@
<Member Id="M:Xamarin.Essentials.GyroscopeData.ToString" />
<Member Id="P:Xamarin.Essentials.GyroscopeData.AngularVelocity" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedback" Id="T:Xamarin.Essentials.HapticFeedback">
<Member Id="M:Xamarin.Essentials.HapticFeedback.Perform(Xamarin.Essentials.HapticFeedbackType)" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedbackType" Id="T:Xamarin.Essentials.HapticFeedbackType">
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.Click" />
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.LongPress" />
</Type>
<Type Name="Xamarin.Essentials.Launcher" Id="T:Xamarin.Essentials.Launcher">
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.String)" />
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.Uri)" />

Просмотреть файл

@ -400,6 +400,13 @@
<Member Id="M:Xamarin.Essentials.GyroscopeData.ToString" />
<Member Id="P:Xamarin.Essentials.GyroscopeData.AngularVelocity" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedback" Id="T:Xamarin.Essentials.HapticFeedback">
<Member Id="M:Xamarin.Essentials.HapticFeedback.Perform(Xamarin.Essentials.HapticFeedbackType)" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedbackType" Id="T:Xamarin.Essentials.HapticFeedbackType">
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.Click" />
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.LongPress" />
</Type>
<Type Name="Xamarin.Essentials.Launcher" Id="T:Xamarin.Essentials.Launcher">
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.String)" />
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.Uri)" />

Просмотреть файл

@ -399,6 +399,13 @@
<Member Id="M:Xamarin.Essentials.GyroscopeData.ToString" />
<Member Id="P:Xamarin.Essentials.GyroscopeData.AngularVelocity" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedback" Id="T:Xamarin.Essentials.HapticFeedback">
<Member Id="M:Xamarin.Essentials.HapticFeedback.Perform(Xamarin.Essentials.HapticFeedbackType)" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedbackType" Id="T:Xamarin.Essentials.HapticFeedbackType">
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.Click" />
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.LongPress" />
</Type>
<Type Name="Xamarin.Essentials.Launcher" Id="T:Xamarin.Essentials.Launcher">
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.String)" />
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.Uri)" />

Просмотреть файл

@ -399,6 +399,13 @@
<Member Id="M:Xamarin.Essentials.GyroscopeData.ToString" />
<Member Id="P:Xamarin.Essentials.GyroscopeData.AngularVelocity" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedback" Id="T:Xamarin.Essentials.HapticFeedback">
<Member Id="M:Xamarin.Essentials.HapticFeedback.Perform(Xamarin.Essentials.HapticFeedbackType)" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedbackType" Id="T:Xamarin.Essentials.HapticFeedbackType">
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.Click" />
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.LongPress" />
</Type>
<Type Name="Xamarin.Essentials.Launcher" Id="T:Xamarin.Essentials.Launcher">
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.String)" />
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.Uri)" />

Просмотреть файл

@ -399,6 +399,13 @@
<Member Id="M:Xamarin.Essentials.GyroscopeData.ToString" />
<Member Id="P:Xamarin.Essentials.GyroscopeData.AngularVelocity" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedback" Id="T:Xamarin.Essentials.HapticFeedback">
<Member Id="M:Xamarin.Essentials.HapticFeedback.Perform(Xamarin.Essentials.HapticFeedbackType)" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedbackType" Id="T:Xamarin.Essentials.HapticFeedbackType">
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.Click" />
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.LongPress" />
</Type>
<Type Name="Xamarin.Essentials.Launcher" Id="T:Xamarin.Essentials.Launcher">
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.String)" />
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.Uri)" />

Просмотреть файл

@ -398,6 +398,13 @@
<Member Id="M:Xamarin.Essentials.GyroscopeData.ToString" />
<Member Id="P:Xamarin.Essentials.GyroscopeData.AngularVelocity" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedback" Id="T:Xamarin.Essentials.HapticFeedback">
<Member Id="M:Xamarin.Essentials.HapticFeedback.Perform(Xamarin.Essentials.HapticFeedbackType)" />
</Type>
<Type Name="Xamarin.Essentials.HapticFeedbackType" Id="T:Xamarin.Essentials.HapticFeedbackType">
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.Click" />
<Member Id="F:Xamarin.Essentials.HapticFeedbackType.LongPress" />
</Type>
<Type Name="Xamarin.Essentials.Launcher" Id="T:Xamarin.Essentials.Launcher">
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.String)" />
<Member Id="M:Xamarin.Essentials.Launcher.CanOpenAsync(System.Uri)" />

Просмотреть файл

@ -0,0 +1,44 @@
<Type Name="HapticFeedback" FullName="Xamarin.Essentials.HapticFeedback">
<TypeSignature Language="C#" Value="public static class HapticFeedback" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit HapticFeedback extends System.Object" />
<TypeSignature Language="DocId" Value="T:Xamarin.Essentials.HapticFeedback" />
<AssemblyInfo>
<AssemblyName>Xamarin.Essentials</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides methods to control HapticFeedback responses</summary>
<remarks>
<para></para>
</remarks>
</Docs>
<Members>
<Member MemberName="Perform">
<MemberSignature Language="C#" Value="public static void Perform (Xamarin.Essentials.HapticFeedbackType type = Xamarin.Essentials.HapticFeedbackType.Click);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Perform(valuetype Xamarin.Essentials.HapticFeedbackType type) cil managed" />
<MemberSignature Language="DocId" Value="M:Xamarin.Essentials.HapticFeedback.Perform(Xamarin.Essentials.HapticFeedbackType)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Xamarin.Essentials</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="type" Type="Xamarin.Essentials.HapticFeedbackType" />
</Parameters>
<Docs>
<param name="type">The type of a HapticFeedback response that will be called</param>
<summary>Calls the platform-oriented method to cause a HapticFeedback response of the specified type</summary>
<remarks>
<para></para>
</remarks>
</Docs>
</Member>
</Members>
</Type>

Просмотреть файл

@ -0,0 +1,54 @@
<Type Name="HapticFeedbackType" FullName="Xamarin.Essentials.HapticFeedbackType">
<TypeSignature Language="C#" Value="public enum HapticFeedbackType" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed HapticFeedbackType extends System.Enum" />
<TypeSignature Language="DocId" Value="T:Xamarin.Essentials.HapticFeedbackType" />
<AssemblyInfo>
<AssemblyName>Xamarin.Essentials</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Enum</BaseTypeName>
</Base>
<Docs>
<summary>Enumerates the possible types of HapticFeedback response</summary>
<remarks>
<para />
</remarks>
</Docs>
<Members>
<Member MemberName="Click">
<MemberSignature Language="C#" Value="Click" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype Xamarin.Essentials.HapticFeedbackType Click = int32(0)" />
<MemberSignature Language="DocId" Value="F:Xamarin.Essentials.HapticFeedbackType.Click" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>Xamarin.Essentials</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Xamarin.Essentials.HapticFeedbackType</ReturnType>
</ReturnValue>
<MemberValue>0</MemberValue>
<Docs>
<summary>Click</summary>
</Docs>
</Member>
<Member MemberName="LongPress">
<MemberSignature Language="C#" Value="LongPress" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype Xamarin.Essentials.HapticFeedbackType LongPress = int32(1)" />
<MemberSignature Language="DocId" Value="F:Xamarin.Essentials.HapticFeedbackType.LongPress" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>Xamarin.Essentials</AssemblyName>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Xamarin.Essentials.HapticFeedbackType</ReturnType>
</ReturnValue>
<MemberValue>1</MemberValue>
<Docs>
<summary>LongPress</summary>
</Docs>
</Member>
</Members>
</Type>

Просмотреть файл

@ -292,7 +292,9 @@
<summary>Degrees relative to true north.</summary>
<value>0..360 in degrees relative to true north. null if unavailable.</value>
<remarks>
<para></para>
<para>
Requires a high accuracy query of location and may not be returned by Geolocation.GetLastKnownLocationAsync
</para>
</remarks>
</Docs>
</Member>

Просмотреть файл

@ -11,7 +11,7 @@
</Base>
<Interfaces />
<Docs>
<summary>Exception that occures when calling an API that requires a specific exception</summary>
<summary>Exception that occures when calling an API that requires a specific permission.</summary>
<remarks>
<para></para>
</remarks>

Просмотреть файл

@ -168,7 +168,7 @@
</ReturnValue>
<Docs>
<summary>Gets or sets the location of the placemark.</summary>
<value>The location of the palcemark.</value>
<value>The location of the placemark.</value>
<remarks>
<para />
</remarks>

Двоичные данные
docs/en/_zip/msdn.4.5.2.zip

Двоичный файл не отображается.

Просмотреть файл

@ -61,9 +61,6 @@
},
"template": [],
"dest": "_site",
"xref": [
"_zip/msdn.4.5.2.zip"
],
"lruSize": 0
}
}

Просмотреть файл

@ -99,7 +99,7 @@
<AttributeName>System.Runtime.Versioning.TargetFramework("Xamarin.Mac,Version=v2.0", FrameworkDisplayName="Xamarin.Mac")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Reflection.AssemblyInformationalVersion("1.0.0+7ca82b58401f37750f9bc7e2c2003da56cc4dfa1")</AttributeName>
<AttributeName>System.Reflection.AssemblyInformationalVersion("1.0.0+205dad63475a814da84490cbfd444821c2d68550")</AttributeName>
</Attribute>
</Attributes>
</Assembly>
@ -170,6 +170,8 @@
<Type Name="Gyroscope" Kind="Class" />
<Type Name="GyroscopeChangedEventArgs" Kind="Class" />
<Type Name="GyroscopeData" Kind="Structure" />
<Type Name="HapticFeedback" Kind="Class" />
<Type Name="HapticFeedbackType" Kind="Enumeration" />
<Type Name="Launcher" Kind="Class" />
<Type Name="Locale" Kind="Class" />
<Type Name="Location" Kind="Class" />