diff --git a/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj b/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj
index d3f02f833..4ba92430f 100644
--- a/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj
+++ b/DeviceTests/DeviceTests.Android/DeviceTests.Android.csproj
@@ -65,7 +65,7 @@
-
+
@@ -74,8 +74,8 @@
-
-
+
+
diff --git a/DeviceTests/DeviceTests.Shared/Barometer_Shared.cs b/DeviceTests/DeviceTests.Shared/Barometer_Shared.cs
index 7567944dc..9095a430a 100644
--- a/DeviceTests/DeviceTests.Shared/Barometer_Shared.cs
+++ b/DeviceTests/DeviceTests.Shared/Barometer_Shared.cs
@@ -29,7 +29,7 @@ void Barometer_ReadingChanged(object sender, BarometerChangedEventArgs e)
var d = await tcs.Task;
- Assert.True(d.Pressure >= 0);
+ Assert.True(d.PressureInHectopascals >= 0);
Barometer.Stop();
Barometer.ReadingChanged -= Barometer_ReadingChanged;
}
diff --git a/DeviceTests/DeviceTests.Shared/Battery_Tests.cs b/DeviceTests/DeviceTests.Shared/Battery_Tests.cs
index 592a75178..ca11c6c78 100644
--- a/DeviceTests/DeviceTests.Shared/Battery_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/Battery_Tests.cs
@@ -42,5 +42,11 @@ public void Charge_Power()
Assert.NotEqual(BatteryPowerSource.Unknown, Battery.PowerSource);
}
+
+ [Fact]
+ public void App_Is_Not_Lower_Power_mode()
+ {
+ Assert.Equal(EnergySaverStatus.Off, Battery.EnergySaverStatus);
+ }
}
}
diff --git a/DeviceTests/DeviceTests.Shared/Clipboard_Tests.cs b/DeviceTests/DeviceTests.Shared/Clipboard_Tests.cs
index 0bfac6b0e..83ae4dd8e 100644
--- a/DeviceTests/DeviceTests.Shared/Clipboard_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/Clipboard_Tests.cs
@@ -13,10 +13,7 @@ public Task Set_Clipboard_Values(string text)
{
return Utils.OnMainThread(async () =>
{
- Clipboard.SetText(text);
-
- await Task.Delay(100);
-
+ await Clipboard.SetTextAsync(text);
Assert.True(Clipboard.HasText);
});
}
@@ -28,7 +25,7 @@ public Task Get_Clipboard_Values(string text)
{
return Utils.OnMainThread(async () =>
{
- Clipboard.SetText(text);
+ await Clipboard.SetTextAsync(text);
var clipText = await Clipboard.GetTextAsync();
Assert.NotNull(clipText);
diff --git a/DeviceTests/DeviceTests.Shared/Connectivity_Tests.cs b/DeviceTests/DeviceTests.Shared/Connectivity_Tests.cs
index 2372d3e41..cc224152b 100644
--- a/DeviceTests/DeviceTests.Shared/Connectivity_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/Connectivity_Tests.cs
@@ -11,7 +11,7 @@ public void Network_Access() =>
Assert.Equal(NetworkAccess.Internet, Connectivity.NetworkAccess);
[Fact]
- public void Profiles() =>
- Assert.True(Connectivity.Profiles.Count() > 0);
+ public void ConnectionProfiles() =>
+ Assert.True(Connectivity.ConnectionProfiles.Count() > 0);
}
}
diff --git a/DeviceTests/DeviceTests.Shared/DeviceInfo_Tests.cs b/DeviceTests/DeviceTests.Shared/DeviceInfo_Tests.cs
index 18c57653e..871d28524 100644
--- a/DeviceTests/DeviceTests.Shared/DeviceInfo_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/DeviceInfo_Tests.cs
@@ -68,11 +68,11 @@ public void AppPackageName_Is_Correct()
public void Platform_Is_Correct()
{
#if WINDOWS_UWP
- Assert.Equal(DeviceInfo.Platforms.UWP, DeviceInfo.Platform);
+ Assert.Equal(DevicePlatform.UWP, DeviceInfo.Platform);
#elif __IOS__
- Assert.Equal(DeviceInfo.Platforms.iOS, DeviceInfo.Platform);
+ Assert.Equal(DevicePlatform.iOS, DeviceInfo.Platform);
#elif __ANDROID__
- Assert.Equal(DeviceInfo.Platforms.Android, DeviceInfo.Platform);
+ Assert.Equal(DevicePlatform.Android, DeviceInfo.Platform);
#else
throw new PlatformNotSupportedException();
#endif
@@ -96,12 +96,56 @@ public Task Screen_Metrics_Are_Not_Null()
{
return Utils.OnMainThread(() =>
{
- var metrics = DeviceDisplay.ScreenMetrics;
+ var metrics = DeviceDisplay.MainDisplayInfo;
Assert.True(metrics.Width > 0);
Assert.True(metrics.Height > 0);
Assert.True(metrics.Density > 0);
});
}
+
+ [Fact]
+ public Task ScreenLock_Locks()
+ {
+ return Utils.OnMainThread(() =>
+ {
+ Assert.False(DeviceDisplay.KeepScreenOn);
+
+ DeviceDisplay.KeepScreenOn = true;
+ Assert.True(DeviceDisplay.KeepScreenOn);
+
+ DeviceDisplay.KeepScreenOn = false;
+ Assert.False(DeviceDisplay.KeepScreenOn);
+ });
+ }
+
+ [Fact]
+ public Task ScreenLock_Unlocks_Without_Locking()
+ {
+ return Utils.OnMainThread(() =>
+ {
+ Assert.False(DeviceDisplay.KeepScreenOn);
+
+ DeviceDisplay.KeepScreenOn = false;
+ Assert.False(DeviceDisplay.KeepScreenOn);
+ });
+ }
+
+ [Fact]
+ public Task ScreenLock_Locks_Only_Once()
+ {
+ return Utils.OnMainThread(() =>
+ {
+ Assert.False(DeviceDisplay.KeepScreenOn);
+
+ DeviceDisplay.KeepScreenOn = true;
+ Assert.True(DeviceDisplay.KeepScreenOn);
+ DeviceDisplay.KeepScreenOn = true;
+ Assert.True(DeviceDisplay.KeepScreenOn);
+
+ DeviceDisplay.KeepScreenOn = false;
+ Assert.False(DeviceDisplay.KeepScreenOn);
+ });
+ }
}
}
diff --git a/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj b/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj
index 045176e6a..2ad635c8e 100644
--- a/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj
+++ b/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.csproj
@@ -29,17 +29,17 @@
pdbonly
-
+
-
-
-
+
+
+
-
+
Windows Mobile Extensions for the UWP
diff --git a/DeviceTests/DeviceTests.Shared/Geocoding_Tests.cs b/DeviceTests/DeviceTests.Shared/Geocoding_Tests.cs
index 7a9fc20c6..8afe13aa5 100644
--- a/DeviceTests/DeviceTests.Shared/Geocoding_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/Geocoding_Tests.cs
@@ -9,7 +9,9 @@ public class Geocoding_Tests
{
public Geocoding_Tests()
{
- Geocoding.MapKey = "RJHqIE53Onrqons5CNOx~FrDr3XhjDTyEXEjng-CRoA~Aj69MhNManYUKxo6QcwZ0wmXBtyva0zwuHB04rFYAPf7qqGJ5cHb03RCDw1jIW8l";
+#if WINDOWS_UWP
+ Platform.MapServiceToken = "RJHqIE53Onrqons5CNOx~FrDr3XhjDTyEXEjng-CRoA~Aj69MhNManYUKxo6QcwZ0wmXBtyva0zwuHB04rFYAPf7qqGJ5cHb03RCDw1jIW8l";
+#endif
}
[Theory]
diff --git a/DeviceTests/DeviceTests.Shared/Maps_Tests.cs b/DeviceTests/DeviceTests.Shared/Maps_Tests.cs
index cf1e0a9c8..ec06693cb 100644
--- a/DeviceTests/DeviceTests.Shared/Maps_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/Maps_Tests.cs
@@ -15,7 +15,7 @@ public class Maps_Tests
[Trait(Traits.InteractionType, Traits.InteractionTypes.Human)]
public async Task LaunchMap_CoordinatesDisplayCorrectPlace()
{
- await Maps.OpenAsync(testLatitude, testLongitude, new MapsLaunchOptions { Name = mapName });
+ await Map.OpenAsync(testLatitude, testLongitude, new MapLaunchOptions { Name = mapName });
}
[Fact]
@@ -29,28 +29,28 @@ public async Task LaunchMap_PlacemarkDisplayCorrectPlace()
Thoroughfare = "Microsoft Building 25",
Locality = "Redmond"
};
- await Maps.OpenAsync(placemark, new MapsLaunchOptions { Name = mapName });
+ await Map.OpenAsync(placemark, new MapLaunchOptions { Name = mapName });
}
[Fact]
public async Task LaunchMap_NullLocation()
{
Location location = null;
- await Assert.ThrowsAsync(() => Maps.OpenAsync(location));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(location));
}
[Fact]
public async Task LaunchMap_NullOptionsLocation()
{
var location = new Location(testLatitude, testLongitude);
- await Assert.ThrowsAsync(() => Maps.OpenAsync(location, null));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(location, null));
}
[Fact]
public async Task LaunchMap_NullPlacemark()
{
Placemark location = null;
- await Assert.ThrowsAsync(() => Maps.OpenAsync(location));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(location));
}
[Fact]
@@ -63,7 +63,7 @@ public async Task LaunchMap_NullOptionsPlacemark()
Thoroughfare = "Microsoft Building 25",
Locality = "Redmond"
};
- await Assert.ThrowsAsync(() => Maps.OpenAsync(placemark, null));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(placemark, null));
}
}
}
diff --git a/DeviceTests/DeviceTests.Shared/Power_Tests.cs b/DeviceTests/DeviceTests.Shared/Power_Tests.cs
deleted file mode 100644
index b1c7164b7..000000000
--- a/DeviceTests/DeviceTests.Shared/Power_Tests.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Xamarin.Essentials;
-using Xunit;
-
-namespace DeviceTests
-{
- public class Power_Tests
- {
- [Fact]
- public void App_Is_Not_Lower_Power_mode()
- {
- Assert.Equal(EnergySaverStatus.Off, Power.EnergySaverStatus);
- }
- }
-}
diff --git a/DeviceTests/DeviceTests.Shared/ScreenLock_Tests.cs b/DeviceTests/DeviceTests.Shared/ScreenLock_Tests.cs
deleted file mode 100644
index b212cc561..000000000
--- a/DeviceTests/DeviceTests.Shared/ScreenLock_Tests.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System.Threading.Tasks;
-using Xamarin.Essentials;
-using Xunit;
-
-namespace DeviceTests
-{
- public class ScreenLock_Tests
- {
- [Fact]
- public Task ScreenLock_Locks()
- {
- return Utils.OnMainThread(() =>
- {
- Assert.False(ScreenLock.IsActive);
-
- ScreenLock.RequestActive();
- Assert.True(ScreenLock.IsActive);
-
- ScreenLock.RequestRelease();
- Assert.False(ScreenLock.IsActive);
- });
- }
-
- [Fact]
- public Task ScreenLock_Unlocks_Without_Locking()
- {
- return Utils.OnMainThread(() =>
- {
- Assert.False(ScreenLock.IsActive);
-
- ScreenLock.RequestRelease();
- Assert.False(ScreenLock.IsActive);
- });
- }
-
- [Fact]
- public Task ScreenLock_Locks_Only_Once()
- {
- return Utils.OnMainThread(() =>
- {
- Assert.False(ScreenLock.IsActive);
-
- ScreenLock.RequestActive();
- Assert.True(ScreenLock.IsActive);
- ScreenLock.RequestActive();
- Assert.True(ScreenLock.IsActive);
-
- ScreenLock.RequestRelease();
- Assert.False(ScreenLock.IsActive);
- });
- }
- }
-}
diff --git a/DeviceTests/DeviceTests.Shared/SecureStorage_Tests.cs b/DeviceTests/DeviceTests.Shared/SecureStorage_Tests.cs
index 01bf35d95..43e616684 100644
--- a/DeviceTests/DeviceTests.Shared/SecureStorage_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/SecureStorage_Tests.cs
@@ -6,6 +6,11 @@ namespace DeviceTests
{
public class SecureStorage_Tests
{
+ public SecureStorage_Tests()
+ {
+ SecureStorage.RemoveAll();
+ }
+
[Theory]
[InlineData("test.txt", "data", true, true)]
[InlineData("noextension", "data2", true, false)]
@@ -40,6 +45,32 @@ public async Task Saves_And_Loads(string key, string data, bool emulatePreApi23,
Assert.Equal(data, c);
}
+#if __ANDROID__
+ [Theory]
+ [InlineData("test.txt", "data")]
+ public async Task Fix_Corrupt_Key(string key, string data)
+ {
+ // set a valid key
+ SecureStorage.AlwaysUseAsymmetricKeyStorage = true;
+ await SecureStorage.SetAsync(key, data);
+
+ // simulate corrupt the key
+ var prefKey = "SecureStorageKey";
+ var mainKey = "A2PfJSNdEDjM+422tpu7FqFcVQQbO3ti/DvnDnIqrq9CFwaBi6NdXYcicjvMW6nF7X/Clpto5xerM41U1H4qtWJDO0Ijc5QNTHGZl9tDSbXJ6yDCDDnEDryj2uTa8DiHoNcNX68QtcV3at4kkJKXXAwZXSC88a73/xDdh1u5gUdCeXJzVc5vOY6QpAGUH0bjR5NHrqEQNNGDdquFGN9n2ZJPsEK6C9fx0QwCIL+uldpAYSWrpmUIr+/0X7Y0mJpN84ldygEVxHLBuVrzB4Bbu5XGLUN/0Sr2plWcKm7XhM6wp3JRW6Eae2ozys42p1YLeM0HXWrhTqP6FRPkS6mOtw==";
+
+ Preferences.Set(prefKey, mainKey, SecureStorage.Alias);
+
+ var c = await SecureStorage.GetAsync(key);
+ Assert.Null(c);
+
+ // try to reset and get again
+ await SecureStorage.SetAsync(key, data);
+ c = await SecureStorage.GetAsync(key);
+
+ Assert.Equal(data, c);
+ }
+#endif
+
[Theory]
[InlineData(true)]
[InlineData(false)]
diff --git a/DeviceTests/DeviceTests.Shared/Vibration_Tests.cs b/DeviceTests/DeviceTests.Shared/Vibration_Tests.cs
index 815a86c03..a2371308f 100644
--- a/DeviceTests/DeviceTests.Shared/Vibration_Tests.cs
+++ b/DeviceTests/DeviceTests.Shared/Vibration_Tests.cs
@@ -17,7 +17,7 @@ public void Vibrate()
#elif __IOS__
// TODO: remove this as soon as the test harness can filter
// the iOS simulator does not emulate a flashlight
- if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DeviceInfo.Platforms.iOS)
+ if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DevicePlatform.iOS)
return;
#endif
@@ -35,7 +35,7 @@ public void Vibrate_Cancel()
#elif __IOS__
// TODO: remove this as soon as the test harness can filter
// the iOS simulator does not emulate a flashlight
- if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DeviceInfo.Platforms.iOS)
+ if (DeviceInfo.DeviceType == DeviceType.Virtual && DeviceInfo.Platform == DevicePlatform.iOS)
return;
#endif
diff --git a/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj b/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj
index ea181c333..47eec6b4f 100644
--- a/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj
+++ b/DeviceTests/DeviceTests.UWP/DeviceTests.UWP.csproj
@@ -127,10 +127,10 @@
-
-
-
-
+
+
+
+
diff --git a/DeviceTests/DeviceTests.iOS/DeviceTests.iOS.csproj b/DeviceTests/DeviceTests.iOS/DeviceTests.iOS.csproj
index bd81986ae..27923203a 100644
--- a/DeviceTests/DeviceTests.iOS/DeviceTests.iOS.csproj
+++ b/DeviceTests/DeviceTests.iOS/DeviceTests.iOS.csproj
@@ -110,9 +110,9 @@
-
-
-
+
+
+
diff --git a/README.md b/README.md
index b7b7c841e..f5999c9be 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,6 @@ The following cross-platform APIs are available in Xamarin.Essentials:
* [Open Browser](https://docs.microsoft.com/xamarin/essentials/open-browser)
* [Orientation Sensor](https://docs.microsoft.com/en-us/xamarin/essentials/orientation-sensor)
* [Phone Dialer](https://docs.microsoft.com/xamarin/essentials/phone-dialer)
-* [Power](https://docs.microsoft.com/en-us/xamarin/essentials/power)
* [Preferences](https://docs.microsoft.com/xamarin/essentials/preferences)
* [Screen Lock](https://docs.microsoft.com/xamarin/essentials/screen-lock)
* [Secure Storage](https://docs.microsoft.com/xamarin/essentials/secure-storage)
diff --git a/Samples/Samples.Android/Samples.Android.csproj b/Samples/Samples.Android/Samples.Android.csproj
index b3bf5896d..584c92bac 100644
--- a/Samples/Samples.Android/Samples.Android.csproj
+++ b/Samples/Samples.Android/Samples.Android.csproj
@@ -33,8 +33,8 @@
false
false
true
- false
- true
+ true
+ false
true
@@ -74,19 +74,11 @@
-
- 1.10.0
-
-
- 1.10.0
-
-
- 1.10.0
-
-
- 1.10.0
-
-
+
+
+
+
+
diff --git a/Samples/Samples.UWP/MainPage.xaml.cs b/Samples/Samples.UWP/MainPage.xaml.cs
index 208683b47..cd0e977ae 100644
--- a/Samples/Samples.UWP/MainPage.xaml.cs
+++ b/Samples/Samples.UWP/MainPage.xaml.cs
@@ -1,4 +1,6 @@
-namespace Samples.UWP
+using Xamarin.Essentials;
+
+namespace Samples.UWP
{
public sealed partial class MainPage : Xamarin.Forms.Platform.UWP.WindowsPage
{
@@ -6,6 +8,8 @@ public MainPage()
{
InitializeComponent();
+ Platform.MapServiceToken = "RJHqIE53Onrqons5CNOx~FrDr3XhjDTyEXEjng-CRoA~Aj69MhNManYUKxo6QcwZ0wmXBtyva0zwuHB04rFYAPf7qqGJ5cHb03RCDw1jIW8l";
+
LoadApplication(new Samples.App());
}
}
diff --git a/Samples/Samples.UWP/Samples.UWP.csproj b/Samples/Samples.UWP/Samples.UWP.csproj
index 891d03dc1..5e43d9dbd 100644
--- a/Samples/Samples.UWP/Samples.UWP.csproj
+++ b/Samples/Samples.UWP/Samples.UWP.csproj
@@ -126,19 +126,11 @@
true
-
- 1.10.0
-
-
- 1.10.0
-
-
- 1.10.0
-
-
- 1.10.0
-
-
+
+
+
+
+
diff --git a/Samples/Samples.iOS/Samples.iOS.csproj b/Samples/Samples.iOS/Samples.iOS.csproj
index f0d2a0d26..e5164258f 100644
--- a/Samples/Samples.iOS/Samples.iOS.csproj
+++ b/Samples/Samples.iOS/Samples.iOS.csproj
@@ -98,19 +98,11 @@
-
- 1.10.0
-
-
- 1.10.0
-
-
- 1.10.0
-
-
- 1.10.0
-
-
+
+
+
+
+
diff --git a/Samples/Samples/App.xaml.cs b/Samples/Samples/App.xaml.cs
index 89a4fa61f..068b4160f 100644
--- a/Samples/Samples/App.xaml.cs
+++ b/Samples/Samples/App.xaml.cs
@@ -38,9 +38,6 @@ protected override void OnStart()
typeof(Crashes),
typeof(Distribute));
}
-
- // set UWP Map Key
- Geocoding.MapKey = "RJHqIE53Onrqons5CNOx~FrDr3XhjDTyEXEjng-CRoA~Aj69MhNManYUKxo6QcwZ0wmXBtyva0zwuHB04rFYAPf7qqGJ5cHb03RCDw1jIW8l";
}
protected override void OnSleep()
diff --git a/Samples/Samples/Samples.csproj b/Samples/Samples/Samples.csproj
index 7f9d31395..ed3c1829a 100644
--- a/Samples/Samples/Samples.csproj
+++ b/Samples/Samples/Samples.csproj
@@ -23,7 +23,7 @@
-
+
diff --git a/Samples/Samples/View/AllSensorsPage.xaml b/Samples/Samples/View/AllSensorsPage.xaml
index 932a63741..d3494eb06 100644
--- a/Samples/Samples/View/AllSensorsPage.xaml
+++ b/Samples/Samples/View/AllSensorsPage.xaml
@@ -63,7 +63,7 @@
diff --git a/Samples/Samples/View/AppInfoPage.xaml b/Samples/Samples/View/AppInfoPage.xaml
index 0fed904e0..50e4e87df 100644
--- a/Samples/Samples/View/AppInfoPage.xaml
+++ b/Samples/Samples/View/AppInfoPage.xaml
@@ -21,7 +21,7 @@
-
+
diff --git a/Samples/Samples/View/CompassPage.xaml b/Samples/Samples/View/CompassPage.xaml
index 32194a575..f6cb83a8c 100644
--- a/Samples/Samples/View/CompassPage.xaml
+++ b/Samples/Samples/View/CompassPage.xaml
@@ -11,7 +11,7 @@
-
+
@@ -36,7 +36,7 @@
Text="{Binding Compass1, StringFormat='Compass 1 Degrees: {0:N}'}" />
@@ -51,7 +51,7 @@
diff --git a/Samples/Samples/View/ConnectivityPage.xaml b/Samples/Samples/View/ConnectivityPage.xaml
index 68a3a2520..e4a87eaf5 100644
--- a/Samples/Samples/View/ConnectivityPage.xaml
+++ b/Samples/Samples/View/ConnectivityPage.xaml
@@ -15,7 +15,7 @@
-
+
diff --git a/Samples/Samples/View/EmailPage.xaml b/Samples/Samples/View/EmailPage.xaml
index 925ab6195..3e92da02f 100644
--- a/Samples/Samples/View/EmailPage.xaml
+++ b/Samples/Samples/View/EmailPage.xaml
@@ -25,9 +25,14 @@
+
+
+
+
+ AutoSize="TextChanges"
+ VerticalOptions="FillAndExpand" HeightRequest="100" />
diff --git a/Samples/Samples/View/ScreenLockPage.xaml b/Samples/Samples/View/KeepScreenOnPage.xaml
similarity index 88%
rename from Samples/Samples/View/ScreenLockPage.xaml
rename to Samples/Samples/View/KeepScreenOnPage.xaml
index 456d48bb2..52f928702 100644
--- a/Samples/Samples/View/ScreenLockPage.xaml
+++ b/Samples/Samples/View/KeepScreenOnPage.xaml
@@ -2,10 +2,10 @@
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.ScreenLockPage"
- Title="Screen Lock">
+ x:Class="Samples.View.KeepScreenOnPage"
+ Title="Keep Screen On">
-
+
diff --git a/Samples/Samples/View/ScreenLockPage.xaml.cs b/Samples/Samples/View/KeepScreenOnPage.xaml.cs
similarity index 52%
rename from Samples/Samples/View/ScreenLockPage.xaml.cs
rename to Samples/Samples/View/KeepScreenOnPage.xaml.cs
index fa138a9d0..2afcb7282 100644
--- a/Samples/Samples/View/ScreenLockPage.xaml.cs
+++ b/Samples/Samples/View/KeepScreenOnPage.xaml.cs
@@ -1,8 +1,8 @@
namespace Samples.View
{
- public partial class ScreenLockPage : BasePage
+ public partial class KeepScreenOnPage : BasePage
{
- public ScreenLockPage()
+ public KeepScreenOnPage()
{
InitializeComponent();
}
diff --git a/Samples/Samples/View/MapsPage.xaml b/Samples/Samples/View/MapsPage.xaml
index 04c0d4a25..e72e2cfb1 100644
--- a/Samples/Samples/View/MapsPage.xaml
+++ b/Samples/Samples/View/MapsPage.xaml
@@ -13,14 +13,12 @@
-
+
+ ItemsSource="{Binding NavigationModes}"
+ SelectedIndex="{Binding NavigationMode, Mode=TwoWay}" />
-
-
diff --git a/Samples/Samples/View/TextToSpeechPage.xaml b/Samples/Samples/View/TextToSpeechPage.xaml
index f2933aa5b..744b46087 100644
--- a/Samples/Samples/View/TextToSpeechPage.xaml
+++ b/Samples/Samples/View/TextToSpeechPage.xaml
@@ -24,18 +24,18 @@
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
diff --git a/Samples/Samples/ViewModel/AccelerometerViewModel.cs b/Samples/Samples/ViewModel/AccelerometerViewModel.cs
index 3d1d21a8d..56924bcdc 100644
--- a/Samples/Samples/ViewModel/AccelerometerViewModel.cs
+++ b/Samples/Samples/ViewModel/AccelerometerViewModel.cs
@@ -12,7 +12,7 @@ public class AccelerometerViewModel : BaseViewModel
double y;
double z;
bool isActive;
- int speed = 2;
+ int speed = 0;
public AccelerometerViewModel()
{
@@ -48,14 +48,8 @@ public bool IsActive
set => SetProperty(ref isActive, value);
}
- public List Speeds { get; } =
- new List
- {
- "Fastest",
- "Game",
- "Normal",
- "User Interface"
- };
+ public string[] Speeds { get; } =
+ Enum.GetNames(typeof(SensorSpeed));
public int Speed
{
diff --git a/Samples/Samples/ViewModel/AppInfoViewModel.cs b/Samples/Samples/ViewModel/AppInfoViewModel.cs
index 4fd33a13b..e32ead06a 100644
--- a/Samples/Samples/ViewModel/AppInfoViewModel.cs
+++ b/Samples/Samples/ViewModel/AppInfoViewModel.cs
@@ -13,11 +13,11 @@ public class AppInfoViewModel : BaseViewModel
public string AppBuild => AppInfo.BuildString;
- public Command OpenSettingsCommand { get; }
+ public Command ShowSettingsUICommand { get; }
public AppInfoViewModel()
{
- OpenSettingsCommand = new Command(() => AppInfo.OpenSettings());
+ ShowSettingsUICommand = new Command(() => AppInfo.ShowSettingsUI());
}
}
}
diff --git a/Samples/Samples/ViewModel/BarometerViewModel.cs b/Samples/Samples/ViewModel/BarometerViewModel.cs
index f1011364f..0a13c036e 100644
--- a/Samples/Samples/ViewModel/BarometerViewModel.cs
+++ b/Samples/Samples/ViewModel/BarometerViewModel.cs
@@ -10,7 +10,7 @@ public class BarometerViewModel : BaseViewModel
{
bool isActive;
double pressure;
- int speed = 2;
+ int speed = 0;
public BarometerViewModel()
{
@@ -34,14 +34,8 @@ public double Pressure
set => SetProperty(ref pressure, value);
}
- public List Speeds { get; } =
- new List
- {
- "Fastest",
- "Game",
- "Normal",
- "User Interface"
- };
+ public string[] Speeds { get; } =
+ Enum.GetNames(typeof(SensorSpeed));
public int Speed
{
@@ -78,7 +72,7 @@ async void OnStartBarometer()
void OnBarometerReadingChanged(object sender, BarometerChangedEventArgs e)
{
- Pressure = e.Reading.Pressure;
+ Pressure = e.Reading.PressureInHectopascals;
}
void OnStop()
diff --git a/Samples/Samples/ViewModel/BatteryViewModel.cs b/Samples/Samples/ViewModel/BatteryViewModel.cs
index eb93dc6d5..61f1f01d3 100644
--- a/Samples/Samples/ViewModel/BatteryViewModel.cs
+++ b/Samples/Samples/ViewModel/BatteryViewModel.cs
@@ -14,20 +14,20 @@ public BatteryViewModel()
public BatteryPowerSource PowerSource => Battery.PowerSource;
- public EnergySaverStatus EnergySaverStatus => Power.EnergySaverStatus;
+ public EnergySaverStatus EnergySaverStatus => Battery.EnergySaverStatus;
public override void OnAppearing()
{
base.OnAppearing();
- Battery.BatteryChanged += OnBatteryChanged;
- Power.EnergySaverStatusChanged += OnEnergySaverStatusChanged;
+ Battery.BatteryInfoChanged += OnBatteryInfoChanged;
+ Battery.EnergySaverStatusChanged += OnEnergySaverStatusChanged;
}
public override void OnDisappearing()
{
- Battery.BatteryChanged -= OnBatteryChanged;
- Power.EnergySaverStatusChanged -= OnEnergySaverStatusChanged;
+ Battery.BatteryInfoChanged -= OnBatteryInfoChanged;
+ Battery.EnergySaverStatusChanged -= OnEnergySaverStatusChanged;
base.OnDisappearing();
}
@@ -37,7 +37,7 @@ void OnEnergySaverStatusChanged(object sender, EnergySaverStatusChangedEventArgs
OnPropertyChanged(nameof(EnergySaverStatus));
}
- void OnBatteryChanged(object sender, BatteryChangedEventArgs e)
+ void OnBatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
{
OnPropertyChanged(nameof(Level));
OnPropertyChanged(nameof(State));
diff --git a/Samples/Samples/ViewModel/ClipboardViewModel.cs b/Samples/Samples/ViewModel/ClipboardViewModel.cs
index d619148d5..73dc02a0e 100644
--- a/Samples/Samples/ViewModel/ClipboardViewModel.cs
+++ b/Samples/Samples/ViewModel/ClipboardViewModel.cs
@@ -24,7 +24,7 @@ public string FieldValue
set => SetProperty(ref fieldValue, value);
}
- void OnCopy() => Clipboard.SetText(FieldValue);
+ async void OnCopy() => await Clipboard.SetTextAsync(FieldValue);
async void OnPaste()
{
diff --git a/Samples/Samples/ViewModel/CompassViewModel.cs b/Samples/Samples/ViewModel/CompassViewModel.cs
index e8314569c..1fe116cef 100644
--- a/Samples/Samples/ViewModel/CompassViewModel.cs
+++ b/Samples/Samples/ViewModel/CompassViewModel.cs
@@ -10,11 +10,11 @@ class CompassViewModel : BaseViewModel
{
bool compass1IsActive;
bool compass2IsActive;
- bool compassApplyLowPassFilter;
+ bool applyLowPassFilter;
double compass1;
double compass2;
- int speed1 = 2;
- int speed2 = 2;
+ int speed1 = 0;
+ int speed2 = 0;
public CompassViewModel()
{
@@ -44,13 +44,12 @@ public bool Compass2IsActive
set => SetProperty(ref compass2IsActive, value);
}
- public bool CompassApplyLowPassFilter
+ public bool ApplyLowPassFilter
{
- get => compassApplyLowPassFilter;
+ get => applyLowPassFilter;
set
{
- SetProperty(ref compassApplyLowPassFilter, value);
- Compass.ApplyLowPassFilter = value;
+ SetProperty(ref applyLowPassFilter, value);
}
}
@@ -78,14 +77,8 @@ public int Speed2
set => SetProperty(ref speed2, value);
}
- public List CompassSpeeds { get; } =
- new List
- {
- "Fastest",
- "Game",
- "Normal",
- "User Interface"
- };
+ public string[] Speeds { get; } =
+ Enum.GetNames(typeof(SensorSpeed));
public override void OnDisappearing()
{
@@ -102,7 +95,7 @@ async void OnStartCompass1()
if (Compass.IsMonitoring)
OnStopCompass2();
- Compass.Start((SensorSpeed)Speed1);
+ Compass.Start((SensorSpeed)Speed1, ApplyLowPassFilter);
Compass.ReadingChanged += OnCompass1ReadingChanged;
Compass1IsActive = true;
}
@@ -140,7 +133,7 @@ async void OnStartCompass2()
if (Compass.IsMonitoring)
OnStopCompass1();
- Compass.Start((SensorSpeed)Speed2);
+ Compass.Start((SensorSpeed)Speed2, ApplyLowPassFilter);
Compass.ReadingChanged += OnCompass2ReadingChanged;
Compass2IsActive = true;
}
diff --git a/Samples/Samples/ViewModel/ConnectivityViewModel.cs b/Samples/Samples/ViewModel/ConnectivityViewModel.cs
index f586cac09..d67492af6 100644
--- a/Samples/Samples/ViewModel/ConnectivityViewModel.cs
+++ b/Samples/Samples/ViewModel/ConnectivityViewModel.cs
@@ -11,12 +11,12 @@ public ConnectivityViewModel()
public string NetworkAccess =>
Connectivity.NetworkAccess.ToString();
- public string Profiles
+ public string ConnectionProfiles
{
get
{
var profiles = string.Empty;
- foreach (var p in Connectivity.Profiles)
+ foreach (var p in Connectivity.ConnectionProfiles)
profiles += "\n" + p.ToString();
return profiles;
}
@@ -38,7 +38,7 @@ public override void OnDisappearing()
void OnConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
{
- OnPropertyChanged(nameof(Profiles));
+ OnPropertyChanged(nameof(ConnectionProfiles));
OnPropertyChanged(nameof(NetworkAccess));
}
}
diff --git a/Samples/Samples/ViewModel/DeviceInfoViewModel.cs b/Samples/Samples/ViewModel/DeviceInfoViewModel.cs
index 8594f0d2e..6fab032d8 100644
--- a/Samples/Samples/ViewModel/DeviceInfoViewModel.cs
+++ b/Samples/Samples/ViewModel/DeviceInfoViewModel.cs
@@ -4,7 +4,7 @@ namespace Samples.ViewModel
{
public class DeviceInfoViewModel : BaseViewModel
{
- ScreenMetrics screenMetrics;
+ DisplayInfo screenMetrics;
public string Model => DeviceInfo.Model;
@@ -16,13 +16,13 @@ public class DeviceInfoViewModel : BaseViewModel
public string Version => DeviceInfo.Version.ToString();
- public string Platform => DeviceInfo.Platform;
+ public DevicePlatform Platform => DeviceInfo.Platform;
- public string Idiom => DeviceInfo.Idiom;
+ public DeviceIdiom Idiom => DeviceInfo.Idiom;
public DeviceType DeviceType => DeviceInfo.DeviceType;
- public ScreenMetrics ScreenMetrics
+ public DisplayInfo ScreenMetrics
{
get => screenMetrics;
set => SetProperty(ref screenMetrics, value);
@@ -32,20 +32,20 @@ public override void OnAppearing()
{
base.OnAppearing();
- DeviceDisplay.ScreenMetricsChanged += OnScreenMetricsChanged;
- ScreenMetrics = DeviceDisplay.ScreenMetrics;
+ DeviceDisplay.MainDisplayInfoChanged += OnScreenMetricsChanged;
+ ScreenMetrics = DeviceDisplay.MainDisplayInfo;
}
public override void OnDisappearing()
{
- DeviceDisplay.ScreenMetricsChanged -= OnScreenMetricsChanged;
+ DeviceDisplay.MainDisplayInfoChanged -= OnScreenMetricsChanged;
base.OnDisappearing();
}
- void OnScreenMetricsChanged(object sender, ScreenMetricsChangedEventArgs e)
+ void OnScreenMetricsChanged(object sender, DisplayInfoChangedEventArgs e)
{
- ScreenMetrics = e.Metrics;
+ ScreenMetrics = e.DisplayInfo;
}
}
}
diff --git a/Samples/Samples/ViewModel/EmailViewModel.cs b/Samples/Samples/ViewModel/EmailViewModel.cs
index 5122972dc..22e1ff0cb 100644
--- a/Samples/Samples/ViewModel/EmailViewModel.cs
+++ b/Samples/Samples/ViewModel/EmailViewModel.cs
@@ -14,6 +14,7 @@ public class EmailViewModel : BaseViewModel
string recipientsTo;
string recipientsCc;
string recipientsBcc;
+ bool isHtml;
public EmailViewModel()
{
@@ -52,6 +53,12 @@ public string RecipientsBcc
set => SetProperty(ref recipientsBcc, value);
}
+ public bool IsHtml
+ {
+ get => isHtml;
+ set => SetProperty(ref isHtml, value);
+ }
+
async void OnSendEmail()
{
if (IsBusy)
@@ -64,6 +71,7 @@ await Email.ComposeAsync(new EmailMessage
{
Subject = Subject,
Body = Body,
+ BodyFormat = isHtml ? EmailBodyFormat.Html : EmailBodyFormat.PlainText,
To = Split(RecipientsTo),
Cc = Split(RecipientsCc),
Bcc = Split(RecipientsBcc),
diff --git a/Samples/Samples/ViewModel/GeolocationViewModel.cs b/Samples/Samples/ViewModel/GeolocationViewModel.cs
index ab3438c7e..09c85ed3f 100644
--- a/Samples/Samples/ViewModel/GeolocationViewModel.cs
+++ b/Samples/Samples/ViewModel/GeolocationViewModel.cs
@@ -11,7 +11,7 @@ public class GeolocationViewModel : BaseViewModel
string notAvailable = "not available";
string lastLocation;
string currentLocation;
- int accuracy = (int)GeolocationAccuracy.Medium;
+ int accuracy = (int)GeolocationAccuracy.Default;
CancellationTokenSource cts;
public GeolocationViewModel()
diff --git a/Samples/Samples/ViewModel/GyroscopeViewModel.cs b/Samples/Samples/ViewModel/GyroscopeViewModel.cs
index 1b685b584..49cc33014 100644
--- a/Samples/Samples/ViewModel/GyroscopeViewModel.cs
+++ b/Samples/Samples/ViewModel/GyroscopeViewModel.cs
@@ -12,7 +12,7 @@ public class GyroscopeViewModel : BaseViewModel
double y;
double z;
bool isActive;
- int speed = 2;
+ int speed = 0;
public GyroscopeViewModel()
{
@@ -48,14 +48,8 @@ public bool IsActive
set => SetProperty(ref isActive, value);
}
- public List Speeds { get; } =
- new List
- {
- "Fastest",
- "Game",
- "Normal",
- "User Interface"
- };
+ public string[] Speeds { get; } =
+ Enum.GetNames(typeof(SensorSpeed));
public int Speed
{
diff --git a/Samples/Samples/ViewModel/HomeViewModel.cs b/Samples/Samples/ViewModel/HomeViewModel.cs
index d613eae50..18612963e 100644
--- a/Samples/Samples/ViewModel/HomeViewModel.cs
+++ b/Samples/Samples/ViewModel/HomeViewModel.cs
@@ -108,6 +108,12 @@ public HomeViewModel()
typeof(GeolocationPage),
"Quickly get the current location.",
new[] { "geolocation", "position", "address", "mapping" }),
+ new SampleItem(
+ "💤",
+ "Keep Screen On",
+ typeof(KeepScreenOnPage),
+ "Keep the device screen awake.",
+ new[] { "screen", "awake", "sleep" }),
new SampleItem(
"📏",
"Launcher",
@@ -150,12 +156,6 @@ public HomeViewModel()
typeof(PreferencesPage),
"Quickly and easily add persistent preferences.",
new[] { "settings", "preferences", "prefs", "storage" }),
- new SampleItem(
- "💤",
- "Screen Lock",
- typeof(ScreenLockPage),
- "Keep the device screen awake.",
- new[] { "screen", "awake", "sleep" }),
new SampleItem(
"🔒",
"Secure Storage",
diff --git a/Samples/Samples/ViewModel/ScreenLockViewModel.cs b/Samples/Samples/ViewModel/KeepScreenOnViewModel.cs
similarity index 70%
rename from Samples/Samples/ViewModel/ScreenLockViewModel.cs
rename to Samples/Samples/ViewModel/KeepScreenOnViewModel.cs
index cf3edf2b3..b4c12b1c2 100644
--- a/Samples/Samples/ViewModel/ScreenLockViewModel.cs
+++ b/Samples/Samples/ViewModel/KeepScreenOnViewModel.cs
@@ -4,15 +4,15 @@
namespace Samples.ViewModel
{
- public class ScreenLockViewModel : BaseViewModel
+ public class KeepScreenOnViewModel : BaseViewModel
{
- public ScreenLockViewModel()
+ public KeepScreenOnViewModel()
{
RequestActiveCommand = new Command(OnRequestActive);
RequestReleaseCommand = new Command(OnRequestRelease);
}
- public bool IsActive => ScreenLock.IsActive;
+ public bool IsActive => DeviceDisplay.KeepScreenOn;
public ICommand RequestActiveCommand { get; }
@@ -20,14 +20,14 @@ public ScreenLockViewModel()
void OnRequestActive()
{
- ScreenLock.RequestActive();
+ DeviceDisplay.KeepScreenOn = true;
OnPropertyChanged(nameof(IsActive));
}
void OnRequestRelease()
{
- ScreenLock.RequestRelease();
+ DeviceDisplay.KeepScreenOn = false;
OnPropertyChanged(nameof(IsActive));
}
diff --git a/Samples/Samples/ViewModel/MagnetometerViewModel.cs b/Samples/Samples/ViewModel/MagnetometerViewModel.cs
index 4b563ce34..198269c6e 100644
--- a/Samples/Samples/ViewModel/MagnetometerViewModel.cs
+++ b/Samples/Samples/ViewModel/MagnetometerViewModel.cs
@@ -12,7 +12,7 @@ public class MagnetometerViewModel : BaseViewModel
double y;
double z;
bool isActive;
- int speed = 2;
+ int speed = 0;
public MagnetometerViewModel()
{
@@ -48,14 +48,8 @@ public bool IsActive
set => SetProperty(ref isActive, value);
}
- public List Speeds { get; } =
- new List
- {
- "Fastest",
- "Game",
- "Normal",
- "User Interface"
- };
+ public string[] Speeds { get; } =
+ Enum.GetNames(typeof(SensorSpeed));
public int Speed
{
diff --git a/Samples/Samples/ViewModel/MapsViewModel.cs b/Samples/Samples/ViewModel/MapsViewModel.cs
index 9642561dd..c5f252e25 100644
--- a/Samples/Samples/ViewModel/MapsViewModel.cs
+++ b/Samples/Samples/ViewModel/MapsViewModel.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Windows.Input;
using Xamarin.Essentials;
using Xamarin.Forms;
@@ -71,23 +72,15 @@ public string ZipCode
set => SetProperty(ref zipCode, value);
}
- public List DirectionModes { get; } =
- new List
- {
- "None",
- "Bicycling",
- "Default",
- "Driving",
- "Transit",
- "Walking"
- };
+ public string[] NavigationModes { get; } =
+ Enum.GetNames(typeof(NavigationMode));
- int directionMode;
+ int navigationMode;
- public int DirectionMode
+ public int NavigationMode
{
- get => directionMode;
- set => SetProperty(ref directionMode, value);
+ get => navigationMode;
+ set => SetProperty(ref navigationMode, value);
}
public ICommand MapsCommand { get; }
@@ -102,7 +95,11 @@ public MapsViewModel()
async void OpenLocation()
{
- await Maps.OpenAsync(double.Parse(Latitude), double.Parse(Longitude), new MapsLaunchOptions { Name = Name, MapDirectionsMode = (MapDirectionsMode)DirectionMode });
+ await Map.OpenAsync(double.Parse(Latitude), double.Parse(Longitude), new MapLaunchOptions
+ {
+ Name = Name,
+ NavigationMode = (NavigationMode)NavigationMode
+ });
}
async void OpenPlacemark()
@@ -115,7 +112,11 @@ async void OpenPlacemark()
Thoroughfare = Thoroughfare,
PostalCode = ZipCode
};
- await Maps.OpenAsync(placemark, new MapsLaunchOptions() { Name = Name, MapDirectionsMode = (MapDirectionsMode)DirectionMode });
+ await Map.OpenAsync(placemark, new MapLaunchOptions
+ {
+ Name = Name,
+ NavigationMode = (NavigationMode)NavigationMode
+ });
}
}
}
diff --git a/Samples/Samples/ViewModel/OrientationSensorViewModel.cs b/Samples/Samples/ViewModel/OrientationSensorViewModel.cs
index 485e1d612..e6758613e 100644
--- a/Samples/Samples/ViewModel/OrientationSensorViewModel.cs
+++ b/Samples/Samples/ViewModel/OrientationSensorViewModel.cs
@@ -13,7 +13,7 @@ class OrientationSensorViewModel : BaseViewModel
double z;
double w;
bool isActive;
- int speed = 2;
+ int speed = 0;
public OrientationSensorViewModel()
{
@@ -55,14 +55,8 @@ public bool IsActive
set => SetProperty(ref isActive, value);
}
- public List Speeds { get; } =
- new List
- {
- "Fastest",
- "Game",
- "Normal",
- "User Interface"
- };
+ public string[] Speeds { get; } =
+ Enum.GetNames(typeof(SensorSpeed));
public int Speed
{
diff --git a/Samples/Samples/ViewModel/TextToSpeechViewModel.cs b/Samples/Samples/ViewModel/TextToSpeechViewModel.cs
index 13a3227ed..7e66f3603 100644
--- a/Samples/Samples/ViewModel/TextToSpeechViewModel.cs
+++ b/Samples/Samples/ViewModel/TextToSpeechViewModel.cs
@@ -12,7 +12,7 @@ public class TextToSpeechViewModel : BaseViewModel
CancellationTokenSource cts;
string text;
- bool advancedSettings;
+ bool advancedOptions;
float volume;
float pitch;
string locale = "Default";
@@ -26,7 +26,7 @@ public TextToSpeechViewModel()
Text = "Xamarin Essentials makes text to speech easy!";
- AdvancedSettings = false;
+ AdvancedOptions = false;
Volume = 1.0f;
Pitch = 1.0f;
}
@@ -47,10 +47,10 @@ void OnSpeak(bool multiple)
cts = new CancellationTokenSource();
- SpeakSettings settings = null;
- if (AdvancedSettings)
+ SpeechOptions options = null;
+ if (AdvancedOptions)
{
- settings = new SpeakSettings
+ options = new SpeechOptions
{
Volume = Volume,
Pitch = Pitch,
@@ -62,13 +62,13 @@ void OnSpeak(bool multiple)
if (multiple)
{
speaks = Task.WhenAll(
- TextToSpeech.SpeakAsync(Text + " 1 ", settings, cancelToken: cts.Token),
- TextToSpeech.SpeakAsync(Text + " 2 ", settings, cancelToken: cts.Token),
- TextToSpeech.SpeakAsync(Text + " 3 ", settings, cancelToken: cts.Token));
+ TextToSpeech.SpeakAsync(Text + " 1 ", options, cancelToken: cts.Token),
+ TextToSpeech.SpeakAsync(Text + " 2 ", options, cancelToken: cts.Token),
+ TextToSpeech.SpeakAsync(Text + " 3 ", options, cancelToken: cts.Token));
}
else
{
- speaks = TextToSpeech.SpeakAsync(Text, settings, cts.Token);
+ speaks = TextToSpeech.SpeakAsync(Text, options, cts.Token);
}
// use ContinueWith so we don't have to catch the cancelled exceptions
@@ -108,10 +108,10 @@ public string Text
set => SetProperty(ref text, value);
}
- public bool AdvancedSettings
+ public bool AdvancedOptions
{
- get => advancedSettings;
- set => SetProperty(ref advancedSettings, value);
+ get => advancedOptions;
+ set => SetProperty(ref advancedOptions, value);
}
public float Volume
diff --git a/Tests/Accelerometer_Tests.cs b/Tests/Accelerometer_Tests.cs
index de8d6a893..5696f5157 100644
--- a/Tests/Accelerometer_Tests.cs
+++ b/Tests/Accelerometer_Tests.cs
@@ -11,7 +11,7 @@ public void Accelerometer_Start() =>
[Fact]
public void Accelerometer_Stop() =>
- Assert.Throws(() => Accelerometer.Start(SensorSpeed.Normal));
+ Assert.Throws(() => Accelerometer.Start(SensorSpeed.Default));
[Fact]
public void Accelerometer_IsMonitoring() =>
diff --git a/Tests/Barometer_Tests.cs b/Tests/Barometer_Tests.cs
index d6e0ca4dd..6d550d94c 100644
--- a/Tests/Barometer_Tests.cs
+++ b/Tests/Barometer_Tests.cs
@@ -12,7 +12,7 @@ public void Barometer_Start() =>
[Fact]
public void Barometer_Stop() =>
- Assert.Throws(() => Barometer.Start(SensorSpeed.Normal));
+ Assert.Throws(() => Barometer.Start(SensorSpeed.Default));
[Fact]
public void Barometer_IsMonitoring() =>
diff --git a/Tests/Battery_Tests.cs b/Tests/Battery_Tests.cs
index 90721cc46..e049667b1 100644
--- a/Tests/Battery_Tests.cs
+++ b/Tests/Battery_Tests.cs
@@ -19,9 +19,9 @@ public void Charge_Power_Source_On_NetStandard() =>
[Fact]
public void Battery_Changed_Event_On_NetStandard() =>
- Assert.Throws(() => Battery.BatteryChanged += Battery_BatteryChanged);
+ Assert.Throws(() => Battery.BatteryInfoChanged += Battery_BatteryInfoChanged);
- void Battery_BatteryChanged(object sender, BatteryChangedEventArgs e)
+ void Battery_BatteryInfoChanged(object sender, BatteryInfoChangedEventArgs e)
{
}
}
diff --git a/Tests/Clipboard_Tests.cs b/Tests/Clipboard_Tests.cs
index 80ded8c41..bbca653c7 100644
--- a/Tests/Clipboard_Tests.cs
+++ b/Tests/Clipboard_Tests.cs
@@ -7,21 +7,15 @@ namespace Tests
public class Clipboard_Tests
{
[Fact]
- public void Clipboard_SetText_Fail_On_NetStandard()
- {
- Assert.Throws(() => Clipboard.SetText("Text"));
- }
+ public async Task Clipboard_SetText_Fail_On_NetStandard() =>
+ await Assert.ThrowsAsync(() => Clipboard.SetTextAsync("Text"));
[Fact]
- public void Clipboard_HasText_Fail_On_NetStandard()
- {
+ public void Clipboard_HasText_Fail_On_NetStandard() =>
Assert.Throws(() => Clipboard.HasText);
- }
[Fact]
- public async Task Clipboard_GetText_Fail_On_NetStandard()
- {
+ public async Task Clipboard_GetText_Fail_On_NetStandard() =>
await Assert.ThrowsAsync(() => Clipboard.GetTextAsync());
- }
}
}
diff --git a/Tests/Compass_Tests.cs b/Tests/Compass_Tests.cs
index 2b29772b8..16fbb9d0f 100644
--- a/Tests/Compass_Tests.cs
+++ b/Tests/Compass_Tests.cs
@@ -12,7 +12,7 @@ public void Compass_Start() =>
[Fact]
public void Compass_Stop() =>
- Assert.Throws(() => Compass.Start(SensorSpeed.Normal));
+ Assert.Throws(() => Compass.Start(SensorSpeed.Default));
[Fact]
public void Compass_IsMonitoring() =>
diff --git a/Tests/Connectivity_Tests.cs b/Tests/Connectivity_Tests.cs
index 604ff222f..83ed7ce03 100644
--- a/Tests/Connectivity_Tests.cs
+++ b/Tests/Connectivity_Tests.cs
@@ -10,8 +10,8 @@ public void Network_Access_On_NetStandard() =>
Assert.Throws(() => Connectivity.NetworkAccess);
[Fact]
- public void Profiles_On_NetStandard() =>
- Assert.Throws(() => Connectivity.Profiles);
+ public void ConnectionProfiles_On_NetStandard() =>
+ Assert.Throws(() => Connectivity.ConnectionProfiles);
[Fact]
public void Connectivity_Changed_Event_On_NetStandard() =>
diff --git a/Tests/DeviceDisplay_Tests.cs b/Tests/DeviceDisplay_Tests.cs
index 3b3173087..985b7a131 100644
--- a/Tests/DeviceDisplay_Tests.cs
+++ b/Tests/DeviceDisplay_Tests.cs
@@ -6,36 +6,36 @@ namespace Tests
public class DeviceDisplay_Tests
{
[Theory]
- [InlineData(0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, true)]
- [InlineData(1.1, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 1.1, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, true)]
- [InlineData(0.0, 0.0, 0.0, ScreenOrientation.Portrait, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Portrait, ScreenRotation.Rotation0, true)]
- [InlineData(1.1, 0.0, 2.2, ScreenOrientation.Landscape, ScreenRotation.Rotation180, 1.1, 0.0, 2.2, ScreenOrientation.Landscape, ScreenRotation.Rotation180, true)]
- [InlineData(1.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
- [InlineData(0.0, 1.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
- [InlineData(0.0, 0.0, 1.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
- [InlineData(0.0, 0.0, 0.0, ScreenOrientation.Portrait, ScreenRotation.Rotation0, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
- [InlineData(1.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation180, 0.0, 0.0, 0.0, ScreenOrientation.Landscape, ScreenRotation.Rotation0, false)]
+ [InlineData(0.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, 0.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, true)]
+ [InlineData(1.1, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, 1.1, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, true)]
+ [InlineData(0.0, 0.0, 0.0, DisplayOrientation.Portrait, DisplayRotation.Rotation0, 0.0, 0.0, 0.0, DisplayOrientation.Portrait, DisplayRotation.Rotation0, true)]
+ [InlineData(1.1, 0.0, 2.2, DisplayOrientation.Landscape, DisplayRotation.Rotation180, 1.1, 0.0, 2.2, DisplayOrientation.Landscape, DisplayRotation.Rotation180, true)]
+ [InlineData(1.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, 0.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, false)]
+ [InlineData(0.0, 1.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, 0.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, false)]
+ [InlineData(0.0, 0.0, 1.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, 0.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, false)]
+ [InlineData(0.0, 0.0, 0.0, DisplayOrientation.Portrait, DisplayRotation.Rotation0, 0.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, false)]
+ [InlineData(1.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation180, 0.0, 0.0, 0.0, DisplayOrientation.Landscape, DisplayRotation.Rotation0, false)]
public void DeviceDisplay_Comparison(
double width1,
double height1,
double density1,
- ScreenOrientation orientation1,
- ScreenRotation rotation1,
+ DisplayOrientation orientation1,
+ DisplayRotation rotation1,
double width2,
double height2,
double density2,
- ScreenOrientation orientation2,
- ScreenRotation rotation2,
+ DisplayOrientation orientation2,
+ DisplayRotation rotation2,
bool equals)
{
- var device1 = new ScreenMetrics(
+ var device1 = new DisplayInfo(
width: width1,
height: height1,
density: density1,
orientation: orientation1,
rotation: rotation1);
- var device2 = new ScreenMetrics(
+ var device2 = new DisplayInfo(
width: width2,
height: height2,
density: density2,
diff --git a/Tests/Gyroscope_Tests.cs b/Tests/Gyroscope_Tests.cs
index 52079cf6b..6ed1025d2 100644
--- a/Tests/Gyroscope_Tests.cs
+++ b/Tests/Gyroscope_Tests.cs
@@ -11,7 +11,7 @@ public void Gyroscope_Start() =>
[Fact]
public void Gyroscope_Stop() =>
- Assert.Throws(() => Gyroscope.Start(SensorSpeed.Normal));
+ Assert.Throws(() => Gyroscope.Start(SensorSpeed.Default));
[Fact]
public void Gyroscope_IsMonitoring() =>
diff --git a/Tests/Magnetometer_Tests.cs b/Tests/Magnetometer_Tests.cs
index 59e788022..6c90f9b9b 100644
--- a/Tests/Magnetometer_Tests.cs
+++ b/Tests/Magnetometer_Tests.cs
@@ -11,7 +11,7 @@ public void Magnetometer_Start() =>
[Fact]
public void Magnetometer_Stop() =>
- Assert.Throws(() => Magnetometer.Start(SensorSpeed.Normal));
+ Assert.Throws(() => Magnetometer.Start(SensorSpeed.Default));
[Fact]
public void Magnetometer_IsMonitoring() =>
diff --git a/Tests/Maps_Tests.cs b/Tests/Maps_Tests.cs
index e5556b689..5a4d8c564 100644
--- a/Tests/Maps_Tests.cs
+++ b/Tests/Maps_Tests.cs
@@ -14,44 +14,44 @@ public class Maps_Tests
[Fact]
public async Task Open_Map_LatLong_NetStandard() =>
await Assert.ThrowsAsync(
- () => Maps.OpenAsync(
+ () => Map.OpenAsync(
testLatitude,
testLongitude,
- new MapsLaunchOptions { Name = mapName }));
+ new MapLaunchOptions { Name = mapName }));
[Fact]
public async Task Open_Map_Location_NetStandard() =>
await Assert.ThrowsAsync(
- () => Maps.OpenAsync(
+ () => Map.OpenAsync(
new Location(testLatitude, testLongitude),
- new MapsLaunchOptions { Name = mapName }));
+ new MapLaunchOptions { Name = mapName }));
[Fact]
public async Task Open_Map_Placemark_NetStandard() =>
await Assert.ThrowsAsync(
- () => Maps.OpenAsync(
+ () => Map.OpenAsync(
new Placemark(),
- new MapsLaunchOptions { Name = mapName }));
+ new MapLaunchOptions { Name = mapName }));
[Fact]
public async Task LaunchMap_NullLocation()
{
Location location = null;
- await Assert.ThrowsAsync(() => Maps.OpenAsync(location));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(location));
}
[Fact]
public async Task LaunchMap_NullOptionsLocation()
{
var location = new Location(testLatitude, testLongitude);
- await Assert.ThrowsAsync(() => Maps.OpenAsync(location, null));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(location, null));
}
[Fact]
public async Task LaunchMap_NullPlacemark()
{
Placemark location = null;
- await Assert.ThrowsAsync(() => Maps.OpenAsync(location));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(location));
}
[Fact]
@@ -64,7 +64,7 @@ public async Task LaunchMap_NullOptionsPlacemark()
Thoroughfare = "Microsoft Building 25",
Locality = "Redmond"
};
- await Assert.ThrowsAsync(() => Maps.OpenAsync(placemark, null));
+ await Assert.ThrowsAsync(() => Map.OpenAsync(placemark, null));
}
}
}
diff --git a/Tests/OrientationSensor_Tests.cs b/Tests/OrientationSensor_Tests.cs
index 64262309c..22fb3f0e5 100644
--- a/Tests/OrientationSensor_Tests.cs
+++ b/Tests/OrientationSensor_Tests.cs
@@ -11,7 +11,7 @@ public void OrientationSensor_Start() =>
[Fact]
public void OrientationSensor_Stop() =>
- Assert.Throws(() => OrientationSensor.Start(SensorSpeed.Normal));
+ Assert.Throws(() => OrientationSensor.Start(SensorSpeed.Default));
[Fact]
public void OrientationSensor_IsMonitoring() =>
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 01460134a..d0d7bae98 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/Tests/UnitConverters_Tests.cs b/Tests/UnitConverters_Tests.cs
new file mode 100644
index 000000000..f4a1a6ed8
--- /dev/null
+++ b/Tests/UnitConverters_Tests.cs
@@ -0,0 +1,138 @@
+using Xamarin.Essentials;
+using Xunit;
+
+namespace Tests
+{
+ public class UnitConverters_Tests
+ {
+ [Theory]
+ [InlineData(-1, -0.0175)]
+ [InlineData(0.1, 0.0017)]
+ [InlineData(0.5, 0.0087)]
+ [InlineData(1, 0.0175)]
+ [InlineData(2, 0.0349)]
+ [InlineData(3, 0.0524)]
+ [InlineData(10, 0.1745)]
+ [InlineData(57.2958, 1)]
+ [InlineData(114.5916, 2)]
+ [InlineData(171.8873, 3)]
+ [InlineData(572.9578, 10)]
+ [InlineData(1000, 17.4533)]
+ [InlineData(57295.7795, 1000)]
+ [InlineData(0, 0)]
+ public void DegreesPerSecondToRadiansPerSecond(double degrees, double radians)
+ {
+ Assert.Equal(radians, UnitConverters.DegreesPerSecondToRadiansPerSecond(degrees), 4);
+ }
+
+ [Theory]
+ [InlineData(-1, -57.2958)]
+ [InlineData(0.0017, 0.0974)]
+ [InlineData(0.0087, 0.4985)]
+ [InlineData(0.0175, 1.0027)]
+ [InlineData(0.0349, 1.9996)]
+ [InlineData(0.0524, 3.0023)]
+ [InlineData(0.1745, 9.9981)]
+ [InlineData(1, 57.2958)]
+ [InlineData(2, 114.5916)]
+ [InlineData(3, 171.8873)]
+ [InlineData(10, 572.9578)]
+ [InlineData(17.4533, 1000.0004)]
+ [InlineData(1000, 57295.7795)]
+ [InlineData(0, 0)]
+ public void RadiansPerSecondToDegreesPerSecond(double radians, double degrees)
+ {
+ Assert.Equal(degrees, UnitConverters.RadiansPerSecondToDegreesPerSecond(radians), 4);
+ }
+
+ [Theory]
+ [InlineData(-1, -10)]
+ [InlineData(0.1, 1)]
+ [InlineData(1, 10)]
+ [InlineData(10, 100)]
+ [InlineData(0, 0)]
+ public void KilopascalsToHectopascals(double kpa, double hpa)
+ {
+ Assert.Equal(hpa, UnitConverters.KilopascalsToHectopascals(kpa), 4);
+ }
+
+ [Theory]
+ [InlineData(-10, -1)]
+ [InlineData(1, 0.1)]
+ [InlineData(10, 1)]
+ [InlineData(100, 10)]
+ [InlineData(0, 0)]
+ public void HectopascalsKilopascals(double hpa, double kpa)
+ {
+ Assert.Equal(kpa, UnitConverters.HectopascalsToKilopascals(hpa), 4);
+ }
+
+ [Theory]
+ [InlineData(-1, -0.0175)]
+ [InlineData(0.1, 0.0017)]
+ [InlineData(1, 0.0175)]
+ [InlineData(10, 0.1745)]
+ [InlineData(180, 3.1416)]
+ [InlineData(360, 6.2832)]
+ [InlineData(10313.2403, 180)]
+ [InlineData(0, 0)]
+ public void DegreesToRadians(double deg, double rad)
+ {
+ Assert.Equal(rad, UnitConverters.DegreesToRadians(deg), 4);
+ }
+
+ [Theory]
+ [InlineData(-1, -57.2958)]
+ [InlineData(0.1, 5.7296)]
+ [InlineData(1, 57.2958)]
+ [InlineData(3.1416, 180.0004)]
+ [InlineData(6.2832, 360.0008)]
+ [InlineData(10, 572.9578)]
+ [InlineData(180, 10313.2403)]
+ [InlineData(360, 20626.4806)]
+ [InlineData(0, 0)]
+ public void RadiansToDegrees(double rad, double deg)
+ {
+ Assert.Equal(deg, UnitConverters.RadiansToDegrees(rad), 4);
+ }
+
+ [Theory]
+ [InlineData(-1, -1.6093)]
+ [InlineData(0.1, 0.1609)]
+ [InlineData(1, 1.6093)]
+ [InlineData(2, 3.2187)]
+ [InlineData(3, 4.828)]
+ [InlineData(10, 16.0934)]
+ [InlineData(0, 0)]
+ public void MilesToKilometers(double miles, double km)
+ {
+ Assert.Equal(km, UnitConverters.MilesToKilometers(miles), 4);
+ }
+
+ [Theory]
+ [InlineData(-1, -0.6214)]
+ [InlineData(0.1, 0.0621)]
+ [InlineData(1, 0.6214)]
+ [InlineData(2, 1.2427)]
+ [InlineData(3, 1.8641)]
+ [InlineData(10, 6.2137)]
+ [InlineData(0, 0)]
+ public void KilometersToMiles(double km, double miles)
+ {
+ Assert.Equal(miles, UnitConverters.KilometersToMiles(km), 4);
+ }
+
+ [Theory]
+ [InlineData(55.85781, -4.24253, 51.509865, -0.118092, 554.3128)] // glasgow -> london
+ [InlineData(36.12, -86.67, 33.94, -118.40, 2886.4444)] // nashville, tn -> los angeles, ca
+ [InlineData(51.509865, -0.118092, -33.92528, 18.42389, 9671.1251)] // london -> cape town
+ [InlineData(51.509865, -0.118092, 40.42028, -3.70577, 1263.4938)] // london -> madrid
+ [InlineData(42.93708, -75.6107, -33.92528, 18.42389, 12789.5628)] // new york -> cape town
+ [InlineData(45.80721, 15.96757, 19.432608, -99.133209, 10264.4796)] // zagreb -> mexico city
+ [InlineData(43.623409, -79.368683, 42.35866, -71.05674, 690.2032)] // toronto -> boston, ma
+ public void CoordinatesToKilometers(double lat1, double lon1, double lat2, double lon2, double distance)
+ {
+ Assert.Equal(distance, UnitConverters.CoordinatesToKilometers(lat1, lon1, lat2, lon2), 4);
+ }
+ }
+}
diff --git a/Xamarin.Essentials/Accelerometer/Accelerometer.shared.cs b/Xamarin.Essentials/Accelerometer/Accelerometer.shared.cs
index 74749f49a..05cb655a4 100644
--- a/Xamarin.Essentials/Accelerometer/Accelerometer.shared.cs
+++ b/Xamarin.Essentials/Accelerometer/Accelerometer.shared.cs
@@ -17,10 +17,10 @@ public static void Start(SensorSpeed sensorSpeed)
throw new FeatureNotSupportedException();
if (IsMonitoring)
- return;
+ throw new InvalidOperationException("Accelerometer has already been started.");
IsMonitoring = true;
- useSyncContext = sensorSpeed == SensorSpeed.Normal || sensorSpeed == SensorSpeed.UI;
+ useSyncContext = sensorSpeed == SensorSpeed.Default || sensorSpeed == SensorSpeed.UI;
try
{
@@ -68,19 +68,19 @@ internal static void OnChanged(AccelerometerChangedEventArgs e)
public class AccelerometerChangedEventArgs : EventArgs
{
- internal AccelerometerChangedEventArgs(AccelerometerData reading) => Reading = reading;
+ public AccelerometerChangedEventArgs(AccelerometerData reading) => Reading = reading;
public AccelerometerData Reading { get; }
}
public readonly struct AccelerometerData : IEquatable
{
- internal AccelerometerData(double x, double y, double z)
+ public AccelerometerData(double x, double y, double z)
: this((float)x, (float)y, (float)z)
{
}
- internal AccelerometerData(float x, float y, float z) =>
+ public AccelerometerData(float x, float y, float z) =>
Acceleration = new Vector3(x, y, z);
public Vector3 Acceleration { get; }
diff --git a/Xamarin.Essentials/AppInfo/AppInfo.android.cs b/Xamarin.Essentials/AppInfo/AppInfo.android.cs
index 7c7d316e6..e9a794ffc 100644
--- a/Xamarin.Essentials/AppInfo/AppInfo.android.cs
+++ b/Xamarin.Essentials/AppInfo/AppInfo.android.cs
@@ -35,7 +35,7 @@ static string PlatformGetBuild()
}
}
- static void PlatformOpenSettings()
+ static void PlatformShowSettingsUI()
{
var context = Platform.GetCurrentActivity(false) ?? Platform.AppContext;
diff --git a/Xamarin.Essentials/AppInfo/AppInfo.ios.cs b/Xamarin.Essentials/AppInfo/AppInfo.ios.cs
index 48da0c5b9..98edf50ff 100644
--- a/Xamarin.Essentials/AppInfo/AppInfo.ios.cs
+++ b/Xamarin.Essentials/AppInfo/AppInfo.ios.cs
@@ -16,7 +16,7 @@ public static partial class AppInfo
static string GetBundleValue(string key)
=> NSBundle.MainBundle.ObjectForInfoDictionary(key)?.ToString();
- static void PlatformOpenSettings() =>
+ static void PlatformShowSettingsUI() =>
UIApplication.SharedApplication.OpenUrl(new NSUrl(UIApplication.OpenSettingsUrlString));
}
}
diff --git a/Xamarin.Essentials/AppInfo/AppInfo.netstandard.cs b/Xamarin.Essentials/AppInfo/AppInfo.netstandard.cs
index e9b606d30..bce6a01a5 100644
--- a/Xamarin.Essentials/AppInfo/AppInfo.netstandard.cs
+++ b/Xamarin.Essentials/AppInfo/AppInfo.netstandard.cs
@@ -10,6 +10,6 @@ public static partial class AppInfo
static string PlatformGetBuild() => throw new NotImplementedInReferenceAssemblyException();
- static void PlatformOpenSettings() => throw new NotImplementedInReferenceAssemblyException();
+ static void PlatformShowSettingsUI() => throw new NotImplementedInReferenceAssemblyException();
}
}
diff --git a/Xamarin.Essentials/AppInfo/AppInfo.shared.cs b/Xamarin.Essentials/AppInfo/AppInfo.shared.cs
index 6856d3c4f..ecbe60ec2 100644
--- a/Xamarin.Essentials/AppInfo/AppInfo.shared.cs
+++ b/Xamarin.Essentials/AppInfo/AppInfo.shared.cs
@@ -14,6 +14,6 @@ public static partial class AppInfo
public static string BuildString => PlatformGetBuild();
- public static void OpenSettings() => PlatformOpenSettings();
+ public static void ShowSettingsUI() => PlatformShowSettingsUI();
}
}
diff --git a/Xamarin.Essentials/AppInfo/AppInfo.uwp.cs b/Xamarin.Essentials/AppInfo/AppInfo.uwp.cs
index 86b473492..b92df8525 100644
--- a/Xamarin.Essentials/AppInfo/AppInfo.uwp.cs
+++ b/Xamarin.Essentials/AppInfo/AppInfo.uwp.cs
@@ -18,7 +18,7 @@ static string PlatformGetVersionString()
static string PlatformGetBuild() =>
Package.Current.Id.Version.Build.ToString(CultureInfo.InvariantCulture);
- static void PlatformOpenSettings() =>
+ static void PlatformShowSettingsUI() =>
Windows.System.Launcher.LaunchUriAsync(new System.Uri("ms-settings:appsfeatures-app")).WatchForError();
}
}
diff --git a/Xamarin.Essentials/Barometer/Barometer.ios.cs b/Xamarin.Essentials/Barometer/Barometer.ios.cs
index 5e1cdd010..88a4b18e6 100644
--- a/Xamarin.Essentials/Barometer/Barometer.ios.cs
+++ b/Xamarin.Essentials/Barometer/Barometer.ios.cs
@@ -15,9 +15,8 @@ static void PlatformStart(SensorSpeed sensorSpeed)
altitudeManager = new CMAltimeter();
altitudeManager.StartRelativeAltitudeUpdates(Platform.GetCurrentQueue(), LocationManagerUpdatedHeading);
- // Heading updates Convert to HectoPascal from KiloPascal
void LocationManagerUpdatedHeading(CMAltitudeData e, NSError error) =>
- OnChanged(new BarometerData(e.Pressure.DoubleValue / 10d));
+ OnChanged(new BarometerData(UnitConverters.KilopascalsToHectopascals(e.Pressure.DoubleValue)));
}
static void PlatformStop()
diff --git a/Xamarin.Essentials/Barometer/Barometer.shared.cs b/Xamarin.Essentials/Barometer/Barometer.shared.cs
index c3677f973..b22aa8681 100644
--- a/Xamarin.Essentials/Barometer/Barometer.shared.cs
+++ b/Xamarin.Essentials/Barometer/Barometer.shared.cs
@@ -16,10 +16,10 @@ public static void Start(SensorSpeed sensorSpeed)
throw new FeatureNotSupportedException();
if (IsMonitoring)
- return;
+ throw new InvalidOperationException("Barometer has already been started.");
IsMonitoring = true;
- useSyncContext = sensorSpeed == SensorSpeed.Normal || sensorSpeed == SensorSpeed.UI;
+ useSyncContext = sensorSpeed == SensorSpeed.Default || sensorSpeed == SensorSpeed.UI;
try
{
@@ -67,7 +67,7 @@ static void OnChanged(BarometerChangedEventArgs e)
public class BarometerChangedEventArgs : EventArgs
{
- internal BarometerChangedEventArgs(BarometerData reading) =>
+ public BarometerChangedEventArgs(BarometerData reading) =>
Reading = reading;
public BarometerData Reading { get; }
@@ -75,10 +75,10 @@ internal BarometerChangedEventArgs(BarometerData reading) =>
public readonly struct BarometerData : IEquatable
{
- internal BarometerData(double pressure) =>
- Pressure = pressure;
+ public BarometerData(double pressure) =>
+ PressureInHectopascals = pressure;
- public double Pressure { get; }
+ public double PressureInHectopascals { get; }
public static bool operator ==(BarometerData left, BarometerData right) =>
Equals(left, right);
@@ -90,11 +90,11 @@ public override bool Equals(object obj) =>
(obj is BarometerData data) && Equals(data);
public bool Equals(BarometerData other) =>
- Pressure.Equals(other.Pressure);
+ PressureInHectopascals.Equals(other.PressureInHectopascals);
public override int GetHashCode() =>
- Pressure.GetHashCode();
+ PressureInHectopascals.GetHashCode();
- public override string ToString() => $"{nameof(Pressure)}: {Pressure}";
+ public override string ToString() => $"{nameof(PressureInHectopascals)}: {PressureInHectopascals}";
}
}
diff --git a/Xamarin.Essentials/Battery/Battery.android.cs b/Xamarin.Essentials/Battery/Battery.android.cs
index 041c147c2..b0bc6f214 100644
--- a/Xamarin.Essentials/Battery/Battery.android.cs
+++ b/Xamarin.Essentials/Battery/Battery.android.cs
@@ -1,19 +1,57 @@
using System;
using Android.Content;
using Android.OS;
-using Debug = System.Diagnostics.Debug;
namespace Xamarin.Essentials
{
public static partial class Battery
{
static BatteryBroadcastReceiver batteryReceiver;
+ static EnergySaverBroadcastReceiver powerReceiver;
+
+ static void StartEnergySaverListeners()
+ {
+ if (!Platform.HasApiLevel(BuildVersionCodes.Lollipop))
+ return;
+
+ powerReceiver = new EnergySaverBroadcastReceiver(OnEnergySaverChanged);
+ Platform.AppContext.RegisterReceiver(powerReceiver, new IntentFilter(PowerManager.ActionPowerSaveModeChanged));
+ }
+
+ static void StopEnergySaverListeners()
+ {
+ if (!Platform.HasApiLevel(BuildVersionCodes.Lollipop))
+ return;
+
+ try
+ {
+ Platform.AppContext.UnregisterReceiver(powerReceiver);
+ }
+ catch (Java.Lang.IllegalArgumentException)
+ {
+ System.Diagnostics.Debug.WriteLine("Energy saver receiver already unregistered. Disposing of it.");
+ }
+ powerReceiver.Dispose();
+ powerReceiver = null;
+ }
+
+ static EnergySaverStatus PlatformEnergySaverStatus
+ {
+ get
+ {
+ var status = false;
+ if (Platform.HasApiLevel(BuildVersionCodes.Lollipop))
+ status = Platform.PowerManager?.IsPowerSaveMode ?? false;
+
+ return status ? EnergySaverStatus.On : EnergySaverStatus.Off;
+ }
+ }
static void StartBatteryListeners()
{
Permissions.EnsureDeclared(PermissionType.Battery);
- batteryReceiver = new BatteryBroadcastReceiver(OnBatteryChanged);
+ batteryReceiver = new BatteryBroadcastReceiver(OnBatteryInfoChanged);
Platform.AppContext.RegisterReceiver(batteryReceiver, new IntentFilter(Intent.ActionBatteryChanged));
}
@@ -25,7 +63,7 @@ static void StopBatteryListeners()
}
catch (Java.Lang.IllegalArgumentException)
{
- Debug.WriteLine("Battery receiver already unregistered. Disposing of it.");
+ System.Diagnostics.Debug.WriteLine("Battery receiver already unregistered. Disposing of it.");
}
batteryReceiver.Dispose();
batteryReceiver = null;
@@ -44,7 +82,7 @@ static double PlatformChargeLevel
var scale = battery.GetIntExtra(BatteryManager.ExtraScale, -1);
if (scale <= 0)
- return -1;
+ return 1.0;
return (double)level / (double)scale;
}
@@ -119,4 +157,20 @@ public BatteryBroadcastReceiver(Action onChanged) =>
public override void OnReceive(Context context, Intent intent) =>
onChanged?.Invoke();
}
+
+ [BroadcastReceiver(Enabled = true, Exported = false, Label = "Essentials Energy Saver Broadcast Receiver")]
+ class EnergySaverBroadcastReceiver : BroadcastReceiver
+ {
+ Action onChanged;
+
+ public EnergySaverBroadcastReceiver()
+ {
+ }
+
+ public EnergySaverBroadcastReceiver(Action onChanged) =>
+ this.onChanged = onChanged;
+
+ public override void OnReceive(Context context, Intent intent) =>
+ onChanged?.Invoke();
+ }
}
diff --git a/Xamarin.Essentials/Battery/Battery.ios.cs b/Xamarin.Essentials/Battery/Battery.ios.cs
index 5945b0cd6..3d371ca9c 100644
--- a/Xamarin.Essentials/Battery/Battery.ios.cs
+++ b/Xamarin.Essentials/Battery/Battery.ios.cs
@@ -7,12 +7,30 @@ public static partial class Battery
{
static NSObject levelObserver;
static NSObject stateObserver;
+ static NSObject saverStatusObserver;
+
+ static void StartEnergySaverListeners()
+ {
+ saverStatusObserver = NSNotificationCenter.DefaultCenter.AddObserver(NSProcessInfo.PowerStateDidChangeNotification, PowerChangedNotification);
+ }
+
+ static void StopEnergySaverListeners()
+ {
+ saverStatusObserver?.Dispose();
+ saverStatusObserver = null;
+ }
+
+ static void PowerChangedNotification(NSNotification notification)
+ => MainThread.BeginInvokeOnMainThread(OnEnergySaverChanged);
+
+ static EnergySaverStatus PlatformEnergySaverStatus =>
+ NSProcessInfo.ProcessInfo?.LowPowerModeEnabled == true ? EnergySaverStatus.On : EnergySaverStatus.Off;
static void StartBatteryListeners()
{
UIDevice.CurrentDevice.BatteryMonitoringEnabled = true;
- levelObserver = UIDevice.Notifications.ObserveBatteryLevelDidChange(BatteryChangedNotification);
- stateObserver = UIDevice.Notifications.ObserveBatteryStateDidChange(BatteryChangedNotification);
+ levelObserver = UIDevice.Notifications.ObserveBatteryLevelDidChange(BatteryInfoChangedNotification);
+ stateObserver = UIDevice.Notifications.ObserveBatteryStateDidChange(BatteryInfoChangedNotification);
}
static void StopBatteryListeners()
@@ -24,8 +42,8 @@ static void StopBatteryListeners()
stateObserver = null;
}
- static void BatteryChangedNotification(object sender, NSNotificationEventArgs args)
- => MainThread.BeginInvokeOnMainThread(OnBatteryChanged);
+ static void BatteryInfoChangedNotification(object sender, NSNotificationEventArgs args)
+ => MainThread.BeginInvokeOnMainThread(OnBatteryInfoChanged);
static double PlatformChargeLevel
{
diff --git a/Xamarin.Essentials/Battery/Battery.netstandard.cs b/Xamarin.Essentials/Battery/Battery.netstandard.cs
index 1b6c7b2bf..f4021e715 100644
--- a/Xamarin.Essentials/Battery/Battery.netstandard.cs
+++ b/Xamarin.Essentials/Battery/Battery.netstandard.cs
@@ -16,5 +16,14 @@ static void StopBatteryListeners() =>
static BatteryPowerSource PlatformPowerSource =>
throw new NotImplementedInReferenceAssemblyException();
+
+ static void StartEnergySaverListeners() =>
+ throw new NotImplementedInReferenceAssemblyException();
+
+ static void StopEnergySaverListeners() =>
+ throw new NotImplementedInReferenceAssemblyException();
+
+ static EnergySaverStatus PlatformEnergySaverStatus =>
+ throw new NotImplementedInReferenceAssemblyException();
}
}
diff --git a/Xamarin.Essentials/Battery/Battery.shared.cs b/Xamarin.Essentials/Battery/Battery.shared.cs
index 6d117b0ca..dab35fbad 100644
--- a/Xamarin.Essentials/Battery/Battery.shared.cs
+++ b/Xamarin.Essentials/Battery/Battery.shared.cs
@@ -4,7 +4,9 @@ namespace Xamarin.Essentials
{
public static partial class Battery
{
- static event EventHandler BatteryChangedInternal;
+ static event EventHandler BatteryInfoChangedInternal;
+
+ static event EventHandler EnergySaverStatusChangedInternal;
// a cache so that events aren't fired unnecessarily
// this is mainly an issue on Android, but we can stiil do this everywhere
@@ -18,15 +20,17 @@ public static partial class Battery
public static BatteryPowerSource PowerSource => PlatformPowerSource;
- public static event EventHandler BatteryChanged
+ public static EnergySaverStatus EnergySaverStatus => PlatformEnergySaverStatus;
+
+ public static event EventHandler BatteryInfoChanged
{
add
{
- var wasRunning = BatteryChangedInternal != null;
+ var wasRunning = BatteryInfoChangedInternal != null;
- BatteryChangedInternal += value;
+ BatteryInfoChangedInternal += value;
- if (!wasRunning && BatteryChangedInternal != null)
+ if (!wasRunning && BatteryInfoChangedInternal != null)
{
SetCurrent();
StartBatteryListeners();
@@ -35,15 +39,38 @@ public static event EventHandler BatteryChanged
remove
{
- var wasRunning = BatteryChangedInternal != null;
+ var wasRunning = BatteryInfoChangedInternal != null;
- BatteryChangedInternal -= value;
+ BatteryInfoChangedInternal -= value;
- if (wasRunning && BatteryChangedInternal == null)
+ if (wasRunning && BatteryInfoChangedInternal == null)
StopBatteryListeners();
}
}
+ public static event EventHandler EnergySaverStatusChanged
+ {
+ add
+ {
+ var wasRunning = EnergySaverStatusChangedInternal != null;
+
+ EnergySaverStatusChangedInternal += value;
+
+ if (!wasRunning && EnergySaverStatusChangedInternal != null)
+ StartEnergySaverListeners();
+ }
+
+ remove
+ {
+ var wasRunning = EnergySaverStatusChangedInternal != null;
+
+ EnergySaverStatusChangedInternal -= value;
+
+ if (wasRunning && EnergySaverStatusChangedInternal == null)
+ StopEnergySaverListeners();
+ }
+ }
+
static void SetCurrent()
{
currentLevel = Battery.ChargeLevel;
@@ -51,44 +78,60 @@ static void SetCurrent()
currentState = Battery.State;
}
- static void OnBatteryChanged(double level, BatteryState state, BatteryPowerSource source)
- => OnBatteryChanged(new BatteryChangedEventArgs(level, state, source));
+ static void OnBatteryInfoChanged(double level, BatteryState state, BatteryPowerSource source)
+ => OnBatteryInfoChanged(new BatteryInfoChangedEventArgs(level, state, source));
- static void OnBatteryChanged()
- => OnBatteryChanged(ChargeLevel, State, PowerSource);
+ static void OnBatteryInfoChanged()
+ => OnBatteryInfoChanged(ChargeLevel, State, PowerSource);
- static void OnBatteryChanged(BatteryChangedEventArgs e)
+ static void OnBatteryInfoChanged(BatteryInfoChangedEventArgs e)
{
if (currentLevel != e.ChargeLevel || currentSource != e.PowerSource || currentState != e.State)
{
SetCurrent();
- BatteryChangedInternal?.Invoke(null, e);
+ BatteryInfoChangedInternal?.Invoke(null, e);
}
}
+
+ static void OnEnergySaverChanged()
+ => OnEnergySaverChanged(EnergySaverStatus);
+
+ static void OnEnergySaverChanged(EnergySaverStatus saverStatus)
+ => OnEnergySaverChanged(new EnergySaverStatusChangedEventArgs(saverStatus));
+
+ static void OnEnergySaverChanged(EnergySaverStatusChangedEventArgs e)
+ => EnergySaverStatusChangedInternal?.Invoke(null, e);
}
public enum BatteryState
{
- Unknown,
- Charging,
- Discharging,
- Full,
- NotCharging,
- NotPresent
+ Unknown = 0,
+ Charging = 1,
+ Discharging = 2,
+ Full = 3,
+ NotCharging = 4,
+ NotPresent = 5
}
public enum BatteryPowerSource
{
- Unknown,
- Battery,
- AC,
- Usb,
- Wireless
+ Unknown = 0,
+ Battery = 1,
+ AC = 2,
+ Usb = 3,
+ Wireless = 4
}
- public class BatteryChangedEventArgs : EventArgs
+ public enum EnergySaverStatus
{
- internal BatteryChangedEventArgs(double level, BatteryState state, BatteryPowerSource source)
+ Unknown = 0,
+ On = 1,
+ Off = 2
+ }
+
+ public class BatteryInfoChangedEventArgs : EventArgs
+ {
+ public BatteryInfoChangedEventArgs(double level, BatteryState state, BatteryPowerSource source)
{
ChargeLevel = level;
State = state;
@@ -106,4 +149,17 @@ public override string ToString() =>
$"{nameof(State)}: {State}, " +
$"{nameof(PowerSource)}: {PowerSource}";
}
+
+ public class EnergySaverStatusChangedEventArgs : EventArgs
+ {
+ public EnergySaverStatusChangedEventArgs(EnergySaverStatus saverStatus)
+ {
+ EnergySaverStatus = saverStatus;
+ }
+
+ public EnergySaverStatus EnergySaverStatus { get; }
+
+ public override string ToString() =>
+ $"{nameof(EnergySaverStatus)}: {EnergySaverStatus}";
+ }
}
diff --git a/Xamarin.Essentials/Battery/Battery.uwp.cs b/Xamarin.Essentials/Battery/Battery.uwp.cs
index 24a80d858..ab91b6c7b 100644
--- a/Xamarin.Essentials/Battery/Battery.uwp.cs
+++ b/Xamarin.Essentials/Battery/Battery.uwp.cs
@@ -1,7 +1,18 @@
-namespace Xamarin.Essentials
+using Windows.System.Power;
+
+namespace Xamarin.Essentials
{
public static partial class Battery
{
+ static void StartEnergySaverListeners() =>
+ PowerManager.EnergySaverStatusChanged += ReportEnergySaverUpdated;
+
+ static void StopEnergySaverListeners() =>
+ PowerManager.EnergySaverStatusChanged -= ReportEnergySaverUpdated;
+
+ static void ReportEnergySaverUpdated(object sender, object e)
+ => MainThread.BeginInvokeOnMainThread(OnEnergySaverChanged);
+
static void StartBatteryListeners() =>
DefaultBattery.ReportUpdated += ReportUpdated;
@@ -9,7 +20,7 @@ static void StopBatteryListeners() =>
DefaultBattery.ReportUpdated -= ReportUpdated;
static void ReportUpdated(object sender, object e)
- => MainThread.BeginInvokeOnMainThread(OnBatteryChanged);
+ => MainThread.BeginInvokeOnMainThread(OnBatteryInfoChanged);
static Windows.Devices.Power.Battery DefaultBattery =>
Windows.Devices.Power.Battery.AggregateBattery;
@@ -19,7 +30,7 @@ static double PlatformChargeLevel
get
{
var finalReport = DefaultBattery.GetReport();
- var finalPercent = -1.0;
+ var finalPercent = 1.0;
var remaining = finalReport.RemainingCapacityInMilliwattHours;
var full = finalReport.FullChargeCapacityInMilliwattHours;
@@ -39,15 +50,15 @@ static BatteryState PlatformState
switch (report.Status)
{
- case Windows.System.Power.BatteryStatus.Charging:
+ case BatteryStatus.Charging:
return BatteryState.Charging;
- case Windows.System.Power.BatteryStatus.Discharging:
+ case BatteryStatus.Discharging:
return BatteryState.Discharging;
- case Windows.System.Power.BatteryStatus.Idle:
+ case BatteryStatus.Idle:
if (ChargeLevel >= 1.0)
return BatteryState.Full;
return BatteryState.NotCharging;
- case Windows.System.Power.BatteryStatus.NotPresent:
+ case BatteryStatus.NotPresent:
return BatteryState.NotPresent;
}
@@ -75,5 +86,8 @@ static BatteryPowerSource PlatformPowerSource
}
}
}
+
+ static EnergySaverStatus PlatformEnergySaverStatus =>
+ PowerManager.EnergySaverStatus == Windows.System.Power.EnergySaverStatus.On ? EnergySaverStatus.On : EnergySaverStatus.Off;
}
}
diff --git a/Xamarin.Essentials/Browser/Browser.android.cs b/Xamarin.Essentials/Browser/Browser.android.cs
index 5116edeff..baa5c40c3 100644
--- a/Xamarin.Essentials/Browser/Browser.android.cs
+++ b/Xamarin.Essentials/Browser/Browser.android.cs
@@ -10,7 +10,7 @@ namespace Xamarin.Essentials
{
public static partial class Browser
{
- static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode)
+ static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode)
{
var nativeUri = AndroidUri.Parse(uri.AbsoluteUri);
@@ -36,7 +36,7 @@ static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode)
break;
}
- return Task.CompletedTask;
+ return Task.FromResult(true);
}
}
}
diff --git a/Xamarin.Essentials/Browser/Browser.ios.cs b/Xamarin.Essentials/Browser/Browser.ios.cs
index eaa4547d0..a5a2c5f93 100644
--- a/Xamarin.Essentials/Browser/Browser.ios.cs
+++ b/Xamarin.Essentials/Browser/Browser.ios.cs
@@ -2,12 +2,13 @@
using System.Threading.Tasks;
using Foundation;
using SafariServices;
+using UIKit;
namespace Xamarin.Essentials
{
public static partial class Browser
{
- static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode)
+ static async Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode)
{
var nativeUrl = new NSUrl(uri.AbsoluteUri);
@@ -21,14 +22,13 @@ static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode)
{
sfViewController.PopoverPresentationController.SourceView = vc.View;
}
- vc.PresentViewController(sfViewController, true, null);
+ await vc.PresentViewControllerAsync(sfViewController, true);
break;
case BrowserLaunchMode.External:
- UIKit.UIApplication.SharedApplication.OpenUrl(nativeUrl);
- break;
+ return await UIApplication.SharedApplication.OpenUrlAsync(nativeUrl, new UIApplicationOpenUrlOptions());
}
- return Task.CompletedTask;
+ return true;
}
}
}
diff --git a/Xamarin.Essentials/Browser/Browser.netstandard.cs b/Xamarin.Essentials/Browser/Browser.netstandard.cs
index 04b68eded..be881a6ed 100644
--- a/Xamarin.Essentials/Browser/Browser.netstandard.cs
+++ b/Xamarin.Essentials/Browser/Browser.netstandard.cs
@@ -5,7 +5,7 @@ namespace Xamarin.Essentials
{
public static partial class Browser
{
- static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode) =>
+ static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchMode) =>
throw new NotImplementedInReferenceAssemblyException();
}
}
diff --git a/Xamarin.Essentials/Browser/Browser.shared.cs b/Xamarin.Essentials/Browser/Browser.shared.cs
index 2f208ffa9..771a12884 100644
--- a/Xamarin.Essentials/Browser/Browser.shared.cs
+++ b/Xamarin.Essentials/Browser/Browser.shared.cs
@@ -21,7 +21,7 @@ public static Task OpenAsync(string uri, BrowserLaunchMode launchMode)
public static Task OpenAsync(Uri uri) =>
OpenAsync(uri, BrowserLaunchMode.SystemPreferred);
- public static Task OpenAsync(Uri uri, BrowserLaunchMode launchMode) =>
+ public static Task OpenAsync(Uri uri, BrowserLaunchMode launchMode) =>
PlatformOpenAsync(EscapeUri(uri), launchMode);
internal static Uri EscapeUri(Uri uri)
@@ -37,7 +37,7 @@ internal static Uri EscapeUri(Uri uri)
public enum BrowserLaunchMode
{
- External,
- SystemPreferred
+ SystemPreferred = 0,
+ External = 1,
}
}
diff --git a/Xamarin.Essentials/Browser/Browser.uwp.cs b/Xamarin.Essentials/Browser/Browser.uwp.cs
index 4ef66ccf0..acafdffa4 100644
--- a/Xamarin.Essentials/Browser/Browser.uwp.cs
+++ b/Xamarin.Essentials/Browser/Browser.uwp.cs
@@ -5,7 +5,7 @@ namespace Xamarin.Essentials
{
public static partial class Browser
{
- static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchType) =>
+ static Task PlatformOpenAsync(Uri uri, BrowserLaunchMode launchType) =>
Windows.System.Launcher.LaunchUriAsync(uri).AsTask();
}
}
diff --git a/Xamarin.Essentials/Clipboard/Clipboard.android.cs b/Xamarin.Essentials/Clipboard/Clipboard.android.cs
index 2540d7e98..7d8acecb7 100644
--- a/Xamarin.Essentials/Clipboard/Clipboard.android.cs
+++ b/Xamarin.Essentials/Clipboard/Clipboard.android.cs
@@ -5,8 +5,11 @@ namespace Xamarin.Essentials
{
public static partial class Clipboard
{
- static void PlatformSetText(string text)
- => Platform.ClipboardManager.PrimaryClip = ClipData.NewPlainText("Text", text);
+ static Task PlatformSetTextAsync(string text)
+ {
+ Platform.ClipboardManager.PrimaryClip = ClipData.NewPlainText("Text", text);
+ return Task.CompletedTask;
+ }
static bool PlatformHasText
=> Platform.ClipboardManager.HasPrimaryClip;
diff --git a/Xamarin.Essentials/Clipboard/Clipboard.ios.cs b/Xamarin.Essentials/Clipboard/Clipboard.ios.cs
index ed5a77c26..569021e47 100644
--- a/Xamarin.Essentials/Clipboard/Clipboard.ios.cs
+++ b/Xamarin.Essentials/Clipboard/Clipboard.ios.cs
@@ -5,8 +5,11 @@ namespace Xamarin.Essentials
{
public static partial class Clipboard
{
- static void PlatformSetText(string text)
- => UIPasteboard.General.String = text;
+ static Task PlatformSetTextAsync(string text)
+ {
+ UIPasteboard.General.String = text;
+ return Task.CompletedTask;
+ }
static bool PlatformHasText
=> UIPasteboard.General.HasStrings;
diff --git a/Xamarin.Essentials/Clipboard/Clipboard.netstandard.cs b/Xamarin.Essentials/Clipboard/Clipboard.netstandard.cs
index 2965fb456..7c2d4cd6c 100644
--- a/Xamarin.Essentials/Clipboard/Clipboard.netstandard.cs
+++ b/Xamarin.Essentials/Clipboard/Clipboard.netstandard.cs
@@ -4,7 +4,7 @@ namespace Xamarin.Essentials
{
public static partial class Clipboard
{
- static void PlatformSetText(string text)
+ static Task PlatformSetTextAsync(string text)
=> throw new NotImplementedInReferenceAssemblyException();
static bool PlatformHasText
diff --git a/Xamarin.Essentials/Clipboard/Clipboard.shared.cs b/Xamarin.Essentials/Clipboard/Clipboard.shared.cs
index 20ac4d25f..a490949de 100644
--- a/Xamarin.Essentials/Clipboard/Clipboard.shared.cs
+++ b/Xamarin.Essentials/Clipboard/Clipboard.shared.cs
@@ -1,12 +1,11 @@
-using System;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
namespace Xamarin.Essentials
{
public static partial class Clipboard
{
- public static void SetText(string text)
- => PlatformSetText(text);
+ public static Task SetTextAsync(string text)
+ => PlatformSetTextAsync(text);
public static bool HasText
=> PlatformHasText;
diff --git a/Xamarin.Essentials/Clipboard/Clipboard.uwp.cs b/Xamarin.Essentials/Clipboard/Clipboard.uwp.cs
index 5730fbca2..9678a3476 100644
--- a/Xamarin.Essentials/Clipboard/Clipboard.uwp.cs
+++ b/Xamarin.Essentials/Clipboard/Clipboard.uwp.cs
@@ -2,25 +2,26 @@
using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;
-using static Windows.ApplicationModel.DataTransfer.Clipboard;
+using WindowsClipboard = Windows.ApplicationModel.DataTransfer.Clipboard;
namespace Xamarin.Essentials
{
public static partial class Clipboard
{
- static void PlatformSetText(string text)
+ static Task PlatformSetTextAsync(string text)
{
var dataPackage = new DataPackage();
dataPackage.SetText(text);
- SetContent(dataPackage);
+ WindowsClipboard.SetContent(dataPackage);
+ return Task.CompletedTask;
}
static bool PlatformHasText
- => GetContent().Contains(StandardDataFormats.Text);
+ => WindowsClipboard.GetContent().Contains(StandardDataFormats.Text);
static Task PlatformGetTextAsync()
{
- var clipboardContent = GetContent();
+ var clipboardContent = WindowsClipboard.GetContent();
return clipboardContent.Contains(StandardDataFormats.Text)
? clipboardContent.GetTextAsync().AsTask()
: Task.FromResult(null);
diff --git a/Xamarin.Essentials/Compass/Compass.android.cs b/Xamarin.Essentials/Compass/Compass.android.cs
index 09c7e519c..856b1670a 100644
--- a/Xamarin.Essentials/Compass/Compass.android.cs
+++ b/Xamarin.Essentials/Compass/Compass.android.cs
@@ -14,12 +14,12 @@ public static partial class Compass
static Sensor magnetometer;
static Sensor accelerometer;
- internal static void PlatformStart(SensorSpeed sensorSpeed)
+ internal static void PlatformStart(SensorSpeed sensorSpeed, bool applyLowPassFilter)
{
var delay = sensorSpeed.ToPlatform();
accelerometer = Platform.SensorManager.GetDefaultSensor(SensorType.Accelerometer);
magnetometer = Platform.SensorManager.GetDefaultSensor(SensorType.MagneticField);
- listener = new SensorListener(accelerometer.Name, magnetometer.Name, delay);
+ listener = new SensorListener(accelerometer.Name, magnetometer.Name, delay, applyLowPassFilter);
Platform.SensorManager.RegisterListener(listener, accelerometer, delay);
Platform.SensorManager.RegisterListener(listener, magnetometer, delay);
}
@@ -48,14 +48,16 @@ class SensorListener : Java.Lang.Object, ISensorEventListener, IDisposable
string magnetometer;
string accelerometer;
+ bool applyLowPassFilter;
- internal SensorListener(string accelerometer, string magnetometer, SensorDelay delay)
+ internal SensorListener(string accelerometer, string magnetometer, SensorDelay delay, bool applyLowPassFilter)
{
this.magnetometer = magnetometer;
this.accelerometer = accelerometer;
+ this.applyLowPassFilter = applyLowPassFilter;
}
- void ISensorEventListener.OnAccuracyChanged(Sensor sensor, [GeneratedEnum] SensorStatus accuracy)
+ void ISensorEventListener.OnAccuracyChanged(Sensor sensor, SensorStatus accuracy)
{
}
@@ -77,7 +79,7 @@ void ISensorEventListener.OnSensorChanged(SensorEvent e)
SensorManager.GetRotationMatrix(r, null, lastAccelerometer, lastMagnetometer);
SensorManager.GetOrientation(r, orientation);
var azimuthInRadians = orientation[0];
- if (Compass.ApplyLowPassFilter)
+ if (applyLowPassFilter)
{
filter.Add(azimuthInRadians);
azimuthInRadians = filter.Average();
diff --git a/Xamarin.Essentials/Compass/Compass.ios.cs b/Xamarin.Essentials/Compass/Compass.ios.cs
index 4e8a491e6..a2cdef23f 100644
--- a/Xamarin.Essentials/Compass/Compass.ios.cs
+++ b/Xamarin.Essentials/Compass/Compass.ios.cs
@@ -17,7 +17,7 @@ public static partial class Compass
static CLLocationManager locationManager;
- internal static void PlatformStart(SensorSpeed sensorSpeed)
+ internal static void PlatformStart(SensorSpeed sensorSpeed, bool applyLowPassFilter)
{
locationManager = new CLLocationManager();
locationManager.ShouldDisplayHeadingCalibration += LocationManagerShouldDisplayHeadingCalibration;
@@ -31,7 +31,7 @@ internal static void PlatformStart(SensorSpeed sensorSpeed)
locationManager.HeadingFilter = GameFilter;
locationManager.DesiredAccuracy = CLLocation.AccurracyBestForNavigation;
break;
- case SensorSpeed.Normal:
+ case SensorSpeed.Default:
locationManager.HeadingFilter = NormalFilter;
locationManager.DesiredAccuracy = CLLocation.AccuracyBest;
break;
diff --git a/Xamarin.Essentials/Compass/Compass.netstandard.cs b/Xamarin.Essentials/Compass/Compass.netstandard.cs
index d12f54272..3d89496a9 100644
--- a/Xamarin.Essentials/Compass/Compass.netstandard.cs
+++ b/Xamarin.Essentials/Compass/Compass.netstandard.cs
@@ -5,7 +5,7 @@ public static partial class Compass
internal static bool IsSupported =>
throw new NotImplementedInReferenceAssemblyException();
- internal static void PlatformStart(SensorSpeed sensorSpeed) =>
+ internal static void PlatformStart(SensorSpeed sensorSpeed, bool applyLowPassFilter) =>
throw new NotImplementedInReferenceAssemblyException();
internal static void PlatformStop() =>
diff --git a/Xamarin.Essentials/Compass/Compass.shared.cs b/Xamarin.Essentials/Compass/Compass.shared.cs
index 658dcace2..04ed69ba0 100644
--- a/Xamarin.Essentials/Compass/Compass.shared.cs
+++ b/Xamarin.Essentials/Compass/Compass.shared.cs
@@ -10,22 +10,22 @@ public static partial class Compass
public static bool IsMonitoring { get; private set; }
- public static bool ApplyLowPassFilter { get; set; }
+ public static void Start(SensorSpeed sensorSpeed) => Start(sensorSpeed, true);
- public static void Start(SensorSpeed sensorSpeed)
+ public static void Start(SensorSpeed sensorSpeed, bool applyLowPassFilter)
{
if (!IsSupported)
throw new FeatureNotSupportedException();
if (IsMonitoring)
- return;
+ throw new InvalidOperationException("Compass has already been started.");
IsMonitoring = true;
- useSyncContext = sensorSpeed == SensorSpeed.Normal || sensorSpeed == SensorSpeed.UI;
+ useSyncContext = sensorSpeed == SensorSpeed.Default || sensorSpeed == SensorSpeed.UI;
try
{
- PlatformStart(sensorSpeed);
+ PlatformStart(sensorSpeed, applyLowPassFilter);
}
catch
{
@@ -69,7 +69,7 @@ internal static void OnChanged(CompassChangedEventArgs e)
public class CompassChangedEventArgs : EventArgs
{
- internal CompassChangedEventArgs(CompassData reading) =>
+ public CompassChangedEventArgs(CompassData reading) =>
Reading = reading;
public CompassData Reading { get; }
@@ -77,7 +77,7 @@ internal CompassChangedEventArgs(CompassData reading) =>
public readonly struct CompassData : IEquatable
{
- internal CompassData(double headingMagneticNorth) =>
+ public CompassData(double headingMagneticNorth) =>
HeadingMagneticNorth = headingMagneticNorth;
public double HeadingMagneticNorth { get; }
diff --git a/Xamarin.Essentials/Compass/Compass.uwp.cs b/Xamarin.Essentials/Compass/Compass.uwp.cs
index b5a2a0490..5c9548b4c 100644
--- a/Xamarin.Essentials/Compass/Compass.uwp.cs
+++ b/Xamarin.Essentials/Compass/Compass.uwp.cs
@@ -20,7 +20,7 @@ public static partial class Compass
internal static bool IsSupported =>
DefaultCompass != null;
- internal static void PlatformStart(SensorSpeed sensorSpeed)
+ internal static void PlatformStart(SensorSpeed sensorSpeed, bool applyLowPassFilter)
{
sensor = DefaultCompass;
diff --git a/Xamarin.Essentials/Connectivity/Connectivity.android.cs b/Xamarin.Essentials/Connectivity/Connectivity.android.cs
index b41e32923..a90476ae0 100644
--- a/Xamarin.Essentials/Connectivity/Connectivity.android.cs
+++ b/Xamarin.Essentials/Connectivity/Connectivity.android.cs
@@ -111,7 +111,7 @@ void ProcessNetworkInfo(NetworkInfo info)
}
}
- static IEnumerable PlatformProfiles
+ static IEnumerable PlatformConnectionProfiles
{
get
{
@@ -165,40 +165,39 @@ internal static ConnectionProfile GetConnectionType(ConnectivityType connectivit
{
case ConnectivityType.Ethernet:
return ConnectionProfile.Ethernet;
- case ConnectivityType.Wimax:
- return ConnectionProfile.WiMAX;
case ConnectivityType.Wifi:
return ConnectionProfile.WiFi;
case ConnectivityType.Bluetooth:
return ConnectionProfile.Bluetooth;
+ case ConnectivityType.Wimax:
case ConnectivityType.Mobile:
case ConnectivityType.MobileDun:
case ConnectivityType.MobileHipri:
case ConnectivityType.MobileMms:
return ConnectionProfile.Cellular;
case ConnectivityType.Dummy:
- return ConnectionProfile.Other;
+ return ConnectionProfile.Unknown;
default:
if (string.IsNullOrWhiteSpace(typeName))
- return ConnectionProfile.Other;
+ return ConnectionProfile.Unknown;
var typeNameLower = typeName.ToLowerInvariant();
if (typeNameLower.Contains("mobile"))
return ConnectionProfile.Cellular;
+ if (typeNameLower.Contains("wimax"))
+ return ConnectionProfile.Cellular;
+
if (typeNameLower.Contains("wifi"))
return ConnectionProfile.WiFi;
- if (typeNameLower.Contains("wimax"))
- return ConnectionProfile.WiMAX;
-
if (typeNameLower.Contains("ethernet"))
return ConnectionProfile.Ethernet;
if (typeNameLower.Contains("bluetooth"))
return ConnectionProfile.Bluetooth;
- return ConnectionProfile.Other;
+ return ConnectionProfile.Unknown;
}
}
}
diff --git a/Xamarin.Essentials/Connectivity/Connectivity.ios.cs b/Xamarin.Essentials/Connectivity/Connectivity.ios.cs
index f8e8954b0..7996ebe27 100644
--- a/Xamarin.Essentials/Connectivity/Connectivity.ios.cs
+++ b/Xamarin.Essentials/Connectivity/Connectivity.ios.cs
@@ -39,7 +39,7 @@ static NetworkAccess PlatformNetworkAccess
}
}
- static IEnumerable PlatformProfiles
+ static IEnumerable PlatformConnectionProfiles
{
get
{
@@ -55,7 +55,7 @@ static IEnumerable PlatformProfiles
yield return ConnectionProfile.WiFi;
break;
default:
- yield return ConnectionProfile.Other;
+ yield return ConnectionProfile.Unknown;
break;
}
}
diff --git a/Xamarin.Essentials/Connectivity/Connectivity.netstandard.cs b/Xamarin.Essentials/Connectivity/Connectivity.netstandard.cs
index 4ce3f4d36..b59f13942 100644
--- a/Xamarin.Essentials/Connectivity/Connectivity.netstandard.cs
+++ b/Xamarin.Essentials/Connectivity/Connectivity.netstandard.cs
@@ -7,7 +7,7 @@ public static partial class Connectivity
static NetworkAccess PlatformNetworkAccess =>
throw new NotImplementedInReferenceAssemblyException();
- static IEnumerable PlatformProfiles =>
+ static IEnumerable PlatformConnectionProfiles =>
throw new NotImplementedInReferenceAssemblyException();
static void StartListeners() =>
diff --git a/Xamarin.Essentials/Connectivity/Connectivity.shared.cs b/Xamarin.Essentials/Connectivity/Connectivity.shared.cs
index 56e198b1e..73b79f589 100644
--- a/Xamarin.Essentials/Connectivity/Connectivity.shared.cs
+++ b/Xamarin.Essentials/Connectivity/Connectivity.shared.cs
@@ -15,7 +15,7 @@ public static partial class Connectivity
public static NetworkAccess NetworkAccess => PlatformNetworkAccess;
- public static IEnumerable Profiles => PlatformProfiles;
+ public static IEnumerable ConnectionProfiles => PlatformConnectionProfiles;
public static event EventHandler ConnectivityChanged
{
@@ -46,18 +46,18 @@ public static event EventHandler ConnectivityChang
static void SetCurrent()
{
currentAccess = NetworkAccess;
- currentProfiles = new List(Profiles);
+ currentProfiles = new List(ConnectionProfiles);
}
static void OnConnectivityChanged(NetworkAccess access, IEnumerable profiles)
=> OnConnectivityChanged(new ConnectivityChangedEventArgs(access, profiles));
static void OnConnectivityChanged()
- => OnConnectivityChanged(NetworkAccess, Profiles);
+ => OnConnectivityChanged(NetworkAccess, ConnectionProfiles);
static void OnConnectivityChanged(ConnectivityChangedEventArgs e)
{
- if (currentAccess != e.NetworkAccess || !currentProfiles.SequenceEqual(e.Profiles))
+ if (currentAccess != e.NetworkAccess || !currentProfiles.SequenceEqual(e.ConnectionProfiles))
{
SetCurrent();
MainThread.BeginInvokeOnMainThread(() => ConnectivityChangedInternal?.Invoke(null, e));
@@ -67,18 +67,18 @@ static void OnConnectivityChanged(ConnectivityChangedEventArgs e)
public class ConnectivityChangedEventArgs : EventArgs
{
- internal ConnectivityChangedEventArgs(NetworkAccess access, IEnumerable profiles)
+ public ConnectivityChangedEventArgs(NetworkAccess access, IEnumerable connectionProfiles)
{
NetworkAccess = access;
- Profiles = profiles;
+ ConnectionProfiles = connectionProfiles;
}
public NetworkAccess NetworkAccess { get; }
- public IEnumerable Profiles { get; }
+ public IEnumerable ConnectionProfiles { get; }
public override string ToString() =>
$"{nameof(NetworkAccess)}: {NetworkAccess}, " +
- $"{nameof(Profiles)}: [{string.Join(", ", Profiles)}]";
+ $"{nameof(ConnectionProfiles)}: [{string.Join(", ", ConnectionProfiles)}]";
}
}
diff --git a/Xamarin.Essentials/Connectivity/Connectivity.shared.enums.cs b/Xamarin.Essentials/Connectivity/Connectivity.shared.enums.cs
index 11bdbde72..8bd308192 100644
--- a/Xamarin.Essentials/Connectivity/Connectivity.shared.enums.cs
+++ b/Xamarin.Essentials/Connectivity/Connectivity.shared.enums.cs
@@ -2,12 +2,11 @@
{
public enum ConnectionProfile
{
- Bluetooth,
- Cellular,
- Ethernet,
- WiMAX,
- WiFi,
- Other
+ Unknown = 0,
+ Bluetooth = 1,
+ Cellular = 2,
+ Ethernet = 3,
+ WiFi = 4
}
public enum NetworkAccess
diff --git a/Xamarin.Essentials/Connectivity/Connectivity.uwp.cs b/Xamarin.Essentials/Connectivity/Connectivity.uwp.cs
index 25ca15b14..4518f7cbf 100644
--- a/Xamarin.Essentials/Connectivity/Connectivity.uwp.cs
+++ b/Xamarin.Essentials/Connectivity/Connectivity.uwp.cs
@@ -38,14 +38,14 @@ static NetworkAccess PlatformNetworkAccess
}
}
- static IEnumerable PlatformProfiles
+ static IEnumerable PlatformConnectionProfiles
{
get
{
var networkInterfaceList = NetworkInformation.GetConnectionProfiles();
foreach (var interfaceInfo in networkInterfaceList.Where(nii => nii.GetNetworkConnectivityLevel() != NetworkConnectivityLevel.None))
{
- var type = ConnectionProfile.Other;
+ var type = ConnectionProfile.Unknown;
if (interfaceInfo.NetworkAdapter != null)
{
diff --git a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs
index fd1fb14ae..d01703b5e 100644
--- a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs
+++ b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs
@@ -1,8 +1,6 @@
using System;
-using Android.App;
using Android.Content;
using Android.Content.Res;
-using Android.OS;
using Android.Provider;
using Android.Runtime;
using Android.Views;
@@ -13,11 +11,30 @@ public static partial class DeviceDisplay
{
static OrientationEventListener orientationListener;
- static ScreenMetrics GetScreenMetrics()
+ static bool PlatformKeepScreenOn
+ {
+ get
+ {
+ var window = Platform.GetCurrentActivity(true)?.Window;
+ var flags = window?.Attributes?.Flags ?? 0;
+ return flags.HasFlag(WindowManagerFlags.KeepScreenOn);
+ }
+
+ set
+ {
+ var window = Platform.GetCurrentActivity(true)?.Window;
+ if (value)
+ window?.AddFlags(WindowManagerFlags.KeepScreenOn);
+ else
+ window?.ClearFlags(WindowManagerFlags.KeepScreenOn);
+ }
+ }
+
+ static DisplayInfo GetMainDisplayInfo()
{
var displayMetrics = Platform.AppContext.Resources?.DisplayMetrics;
- return new ScreenMetrics(
+ return new DisplayInfo(
width: displayMetrics?.WidthPixels ?? 0,
height: displayMetrics?.HeightPixels ?? 0,
density: displayMetrics?.Density ?? 0,
@@ -40,11 +57,11 @@ static void StopScreenMetricsListeners()
static void OnScreenMetricsChanged()
{
- var metrics = GetScreenMetrics();
- OnScreenMetricsChanged(metrics);
+ var metrics = GetMainDisplayInfo();
+ OnMainDisplayInfoChanged(metrics);
}
- static ScreenRotation CalculateRotation()
+ static DisplayRotation CalculateRotation()
{
var service = Platform.AppContext.GetSystemService(Context.WindowService);
var display = service?.JavaCast()?.DefaultDisplay;
@@ -54,20 +71,20 @@ static ScreenRotation CalculateRotation()
switch (display.Rotation)
{
case SurfaceOrientation.Rotation270:
- return ScreenRotation.Rotation270;
+ return DisplayRotation.Rotation270;
case SurfaceOrientation.Rotation180:
- return ScreenRotation.Rotation180;
+ return DisplayRotation.Rotation180;
case SurfaceOrientation.Rotation90:
- return ScreenRotation.Rotation90;
+ return DisplayRotation.Rotation90;
case SurfaceOrientation.Rotation0:
- return ScreenRotation.Rotation0;
+ return DisplayRotation.Rotation0;
}
}
- return ScreenRotation.Rotation0;
+ return DisplayRotation.Unknown;
}
- static ScreenOrientation CalculateOrientation()
+ static DisplayOrientation CalculateOrientation()
{
var config = Platform.AppContext.Resources?.Configuration;
@@ -76,14 +93,14 @@ static ScreenOrientation CalculateOrientation()
switch (config.Orientation)
{
case Orientation.Landscape:
- return ScreenOrientation.Landscape;
+ return DisplayOrientation.Landscape;
case Orientation.Portrait:
case Orientation.Square:
- return ScreenOrientation.Portrait;
+ return DisplayOrientation.Portrait;
}
}
- return ScreenOrientation.Unknown;
+ return DisplayOrientation.Unknown;
}
static string GetSystemSetting(string name)
@@ -92,13 +109,10 @@ static string GetSystemSetting(string name)
class Listener : OrientationEventListener
{
- Action onChanged;
+ readonly Action onChanged;
internal Listener(Context context, Action handler)
- : base(context)
- {
- onChanged = handler;
- }
+ : base(context) => onChanged = handler;
public override void OnOrientationChanged(int orientation) => onChanged();
}
diff --git a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.ios.cs b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.ios.cs
index 30d0eb156..5ef3de6b4 100644
--- a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.ios.cs
+++ b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.ios.cs
@@ -1,5 +1,4 @@
using Foundation;
-using ObjCRuntime;
using UIKit;
namespace Xamarin.Essentials
@@ -8,12 +7,18 @@ public static partial class DeviceDisplay
{
static NSObject observer;
- static ScreenMetrics GetScreenMetrics()
+ static bool PlatformKeepScreenOn
+ {
+ get => UIApplication.SharedApplication.IdleTimerDisabled;
+ set => UIApplication.SharedApplication.IdleTimerDisabled = value;
+ }
+
+ static DisplayInfo GetMainDisplayInfo()
{
var bounds = UIScreen.MainScreen.Bounds;
var scale = UIScreen.MainScreen.Scale;
- return new ScreenMetrics(
+ return new DisplayInfo(
width: bounds.Width * scale,
height: bounds.Height * scale,
density: scale,
@@ -36,37 +41,37 @@ static void StopScreenMetricsListeners()
static void OnScreenMetricsChanged(NSNotification obj)
{
- var metrics = GetScreenMetrics();
- OnScreenMetricsChanged(metrics);
+ var metrics = GetMainDisplayInfo();
+ OnMainDisplayInfoChanged(metrics);
}
- static ScreenOrientation CalculateOrientation()
+ static DisplayOrientation CalculateOrientation()
{
var orientation = UIApplication.SharedApplication.StatusBarOrientation;
if (orientation.IsLandscape())
- return ScreenOrientation.Landscape;
+ return DisplayOrientation.Landscape;
- return ScreenOrientation.Portrait;
+ return DisplayOrientation.Portrait;
}
- static ScreenRotation CalculateRotation()
+ static DisplayRotation CalculateRotation()
{
var orientation = UIApplication.SharedApplication.StatusBarOrientation;
switch (orientation)
{
case UIInterfaceOrientation.Portrait:
- return ScreenRotation.Rotation0;
+ return DisplayRotation.Rotation0;
case UIInterfaceOrientation.PortraitUpsideDown:
- return ScreenRotation.Rotation180;
+ return DisplayRotation.Rotation180;
case UIInterfaceOrientation.LandscapeLeft:
- return ScreenRotation.Rotation270;
+ return DisplayRotation.Rotation270;
case UIInterfaceOrientation.LandscapeRight:
- return ScreenRotation.Rotation90;
+ return DisplayRotation.Rotation90;
}
- return ScreenRotation.Rotation0;
+ return DisplayRotation.Unknown;
}
}
}
diff --git a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.netstandard.cs b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.netstandard.cs
index 4a6ee8647..0b44c8c2d 100644
--- a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.netstandard.cs
+++ b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.netstandard.cs
@@ -2,7 +2,13 @@
{
public static partial class DeviceDisplay
{
- static ScreenMetrics GetScreenMetrics() => throw new NotImplementedInReferenceAssemblyException();
+ static bool PlatformKeepScreenOn
+ {
+ get => throw new NotImplementedInReferenceAssemblyException();
+ set => throw new NotImplementedInReferenceAssemblyException();
+ }
+
+ static DisplayInfo GetMainDisplayInfo() => throw new NotImplementedInReferenceAssemblyException();
static void StartScreenMetricsListeners() => throw new NotImplementedInReferenceAssemblyException();
diff --git a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.shared.cs b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.shared.cs
index cf878627e..7583ccac9 100644
--- a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.shared.cs
+++ b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.shared.cs
@@ -4,121 +4,65 @@ namespace Xamarin.Essentials
{
public static partial class DeviceDisplay
{
- static event EventHandler ScreenMetricsChangedInternal;
+ static event EventHandler MainDisplayInfoChangedInternal;
- static ScreenMetrics currentMetrics;
+ static DisplayInfo currentMetrics;
- public static ScreenMetrics ScreenMetrics => GetScreenMetrics();
+ public static bool KeepScreenOn
+ {
+ get => PlatformKeepScreenOn;
+ set => PlatformKeepScreenOn = value;
+ }
- static void SetCurrent(ScreenMetrics metrics) =>
- currentMetrics = new ScreenMetrics(metrics.Width, metrics.Height, metrics.Density, metrics.Orientation, metrics.Rotation);
+ public static DisplayInfo MainDisplayInfo => GetMainDisplayInfo();
- public static event EventHandler ScreenMetricsChanged
+ static void SetCurrent(DisplayInfo metrics) =>
+ currentMetrics = new DisplayInfo(metrics.Width, metrics.Height, metrics.Density, metrics.Orientation, metrics.Rotation);
+
+ public static event EventHandler MainDisplayInfoChanged
{
add
{
- var wasRunning = ScreenMetricsChangedInternal != null;
+ var wasRunning = MainDisplayInfoChangedInternal != null;
- ScreenMetricsChangedInternal += value;
+ MainDisplayInfoChangedInternal += value;
- if (!wasRunning && ScreenMetricsChangedInternal != null)
+ if (!wasRunning && MainDisplayInfoChangedInternal != null)
{
- SetCurrent(GetScreenMetrics());
+ SetCurrent(GetMainDisplayInfo());
StartScreenMetricsListeners();
}
}
remove
{
- var wasRunning = ScreenMetricsChangedInternal != null;
+ var wasRunning = MainDisplayInfoChangedInternal != null;
- ScreenMetricsChangedInternal -= value;
+ MainDisplayInfoChangedInternal -= value;
- if (wasRunning && ScreenMetricsChangedInternal == null)
+ if (wasRunning && MainDisplayInfoChangedInternal == null)
StopScreenMetricsListeners();
}
}
- static void OnScreenMetricsChanged(ScreenMetrics metrics)
- => OnScreenMetricsChanged(new ScreenMetricsChangedEventArgs(metrics));
+ static void OnMainDisplayInfoChanged(DisplayInfo metrics)
+ => OnMainDisplayInfoChanged(new DisplayInfoChangedEventArgs(metrics));
- static void OnScreenMetricsChanged(ScreenMetricsChangedEventArgs e)
+ static void OnMainDisplayInfoChanged(DisplayInfoChangedEventArgs e)
{
- if (!currentMetrics.Equals(e.Metrics))
+ if (!currentMetrics.Equals(e.DisplayInfo))
{
- SetCurrent(e.Metrics);
- ScreenMetricsChangedInternal?.Invoke(null, e);
+ SetCurrent(e.DisplayInfo);
+ MainDisplayInfoChangedInternal?.Invoke(null, e);
}
}
}
- public class ScreenMetricsChangedEventArgs : EventArgs
- {
- public ScreenMetricsChangedEventArgs(ScreenMetrics metrics) =>
- Metrics = metrics;
-
- public ScreenMetrics Metrics { get; }
- }
-
- [Preserve(AllMembers = true)]
- public readonly struct ScreenMetrics : IEquatable
+ public class DisplayInfoChangedEventArgs : EventArgs
{
- internal ScreenMetrics(double width, double height, double density, ScreenOrientation orientation, ScreenRotation rotation)
- {
- Width = width;
- Height = height;
- Density = density;
- Orientation = orientation;
- Rotation = rotation;
- }
-
- public double Width { get; }
-
- public double Height { get; }
-
- public double Density { get; }
-
- public ScreenOrientation Orientation { get; }
+ public DisplayInfoChangedEventArgs(DisplayInfo displayInfo) =>
+ DisplayInfo = displayInfo;
- public ScreenRotation Rotation { get; }
-
- public static bool operator ==(ScreenMetrics left, ScreenMetrics right) =>
- Equals(left, right);
-
- public static bool operator !=(ScreenMetrics left, ScreenMetrics right) =>
- !Equals(left, right);
-
- public override bool Equals(object obj) =>
- (obj is ScreenMetrics metrics) && Equals(metrics);
-
- public bool Equals(ScreenMetrics other) =>
- Width.Equals(other.Width) &&
- Height.Equals(other.Height) &&
- Density.Equals(other.Density) &&
- Orientation.Equals(other.Orientation) &&
- Rotation.Equals(other.Rotation);
-
- public override int GetHashCode() =>
- (Height, Width, Density, Orientation, Rotation).GetHashCode();
-
- public override string ToString() =>
- $"{nameof(Height)}: {Height}, {nameof(Width)}: {Width}, " +
- $"{nameof(Density)}: {Density}, {nameof(Orientation)}: {Orientation}, " +
- $"{nameof(Rotation)}: {Rotation}";
- }
-
- public enum ScreenOrientation
- {
- Unknown,
- Portrait,
- Landscape
- }
-
- public enum ScreenRotation
- {
- Rotation0,
- Rotation90,
- Rotation180,
- Rotation270
+ public DisplayInfo DisplayInfo { get; }
}
}
diff --git a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.uwp.cs b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.uwp.cs
index ab51daabc..328055374 100644
--- a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.uwp.cs
+++ b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.uwp.cs
@@ -1,22 +1,60 @@
using Windows.Graphics.Display;
+using Windows.System.Display;
namespace Xamarin.Essentials
{
public static partial class DeviceDisplay
{
- static ScreenMetrics GetScreenMetrics(DisplayInformation di = null)
+ static readonly object locker = new object();
+ static DisplayRequest displayRequest;
+
+ static bool PlatformKeepScreenOn
+ {
+ get
+ {
+ lock (locker)
+ {
+ return displayRequest != null;
+ }
+ }
+
+ set
+ {
+ lock (locker)
+ {
+ if (value)
+ {
+ if (displayRequest == null)
+ {
+ displayRequest = new DisplayRequest();
+ displayRequest.RequestActive();
+ }
+ }
+ else
+ {
+ if (displayRequest != null)
+ {
+ displayRequest.RequestRelease();
+ displayRequest = null;
+ }
+ }
+ }
+ }
+ }
+
+ static DisplayInfo GetMainDisplayInfo(DisplayInformation di = null)
{
di = di ?? DisplayInformation.GetForCurrentView();
var rotation = CalculateRotation(di);
var perpendicular =
- rotation == ScreenRotation.Rotation90 ||
- rotation == ScreenRotation.Rotation270;
+ rotation == DisplayRotation.Rotation90 ||
+ rotation == DisplayRotation.Rotation270;
var w = di.ScreenWidthInRawPixels;
var h = di.ScreenHeightInRawPixels;
- return new ScreenMetrics(
+ return new DisplayInfo(
width: perpendicular ? h : w,
height: perpendicular ? w : h,
density: di.LogicalDpi / 96.0,
@@ -48,26 +86,26 @@ static void StopScreenMetricsListeners()
static void OnDisplayInformationChanged(DisplayInformation di, object args)
{
- var metrics = GetScreenMetrics(di);
- OnScreenMetricsChanged(metrics);
+ var metrics = GetMainDisplayInfo(di);
+ OnMainDisplayInfoChanged(metrics);
}
- static ScreenOrientation CalculateOrientation(DisplayInformation di)
+ static DisplayOrientation CalculateOrientation(DisplayInformation di)
{
switch (di.CurrentOrientation)
{
case DisplayOrientations.Landscape:
case DisplayOrientations.LandscapeFlipped:
- return ScreenOrientation.Landscape;
+ return DisplayOrientation.Landscape;
case DisplayOrientations.Portrait:
case DisplayOrientations.PortraitFlipped:
- return ScreenOrientation.Portrait;
+ return DisplayOrientation.Portrait;
}
- return ScreenOrientation.Unknown;
+ return DisplayOrientation.Unknown;
}
- static ScreenRotation CalculateRotation(DisplayInformation di)
+ static DisplayRotation CalculateRotation(DisplayInformation di)
{
var native = di.NativeOrientation;
var current = di.CurrentOrientation;
@@ -76,24 +114,24 @@ static ScreenRotation CalculateRotation(DisplayInformation di)
{
switch (current)
{
- case DisplayOrientations.Landscape: return ScreenRotation.Rotation90;
- case DisplayOrientations.Portrait: return ScreenRotation.Rotation0;
- case DisplayOrientations.LandscapeFlipped: return ScreenRotation.Rotation270;
- case DisplayOrientations.PortraitFlipped: return ScreenRotation.Rotation180;
+ case DisplayOrientations.Landscape: return DisplayRotation.Rotation90;
+ case DisplayOrientations.Portrait: return DisplayRotation.Rotation0;
+ case DisplayOrientations.LandscapeFlipped: return DisplayRotation.Rotation270;
+ case DisplayOrientations.PortraitFlipped: return DisplayRotation.Rotation180;
}
}
else if (native == DisplayOrientations.Landscape)
{
switch (current)
{
- case DisplayOrientations.Landscape: return ScreenRotation.Rotation0;
- case DisplayOrientations.Portrait: return ScreenRotation.Rotation270;
- case DisplayOrientations.LandscapeFlipped: return ScreenRotation.Rotation180;
- case DisplayOrientations.PortraitFlipped: return ScreenRotation.Rotation90;
+ case DisplayOrientations.Landscape: return DisplayRotation.Rotation0;
+ case DisplayOrientations.Portrait: return DisplayRotation.Rotation270;
+ case DisplayOrientations.LandscapeFlipped: return DisplayRotation.Rotation180;
+ case DisplayOrientations.PortraitFlipped: return DisplayRotation.Rotation90;
}
}
- return ScreenRotation.Rotation0;
+ return DisplayRotation.Unknown;
}
}
}
diff --git a/Xamarin.Essentials/DeviceInfo/DeviceInfo.android.cs b/Xamarin.Essentials/DeviceInfo/DeviceInfo.android.cs
index 6ddf53c21..38f163101 100644
--- a/Xamarin.Essentials/DeviceInfo/DeviceInfo.android.cs
+++ b/Xamarin.Essentials/DeviceInfo/DeviceInfo.android.cs
@@ -24,11 +24,11 @@ static string GetDeviceName()
static string GetVersionString() => Build.VERSION.Release;
- static string GetPlatform() => Platforms.Android;
+ static DevicePlatform GetPlatform() => DevicePlatform.Android;
- static string GetIdiom()
+ static DeviceIdiom GetIdiom()
{
- var currentIdiom = Idioms.Unsupported;
+ var currentIdiom = DeviceIdiom.Unknown;
// first try UIModeManager
using (var uiModeManager = UiModeManager.FromContext(Essentials.Platform.AppContext))
@@ -38,7 +38,7 @@ static string GetIdiom()
}
// then try Configuration
- if (currentIdiom == Idioms.Unsupported)
+ if (currentIdiom == DeviceIdiom.Unknown)
{
var configuration = Essentials.Platform.AppContext.Resources?.Configuration;
if (configuration != null)
@@ -47,24 +47,24 @@ static string GetIdiom()
currentIdiom = DetectIdiom(uiMode);
// now just guess
- if (currentIdiom == Idioms.Unsupported)
+ if (currentIdiom == DeviceIdiom.Unknown)
{
var minWidth = configuration.SmallestScreenWidthDp;
var isWide = minWidth >= tabletCrossover;
- currentIdiom = isWide ? Idioms.Tablet : Idioms.Phone;
+ currentIdiom = isWide ? DeviceIdiom.Tablet : DeviceIdiom.Phone;
}
}
}
// start clutching at straws
- if (currentIdiom == Idioms.Unsupported)
+ if (currentIdiom == DeviceIdiom.Unknown)
{
var metrics = Essentials.Platform.AppContext.Resources?.DisplayMetrics;
if (metrics != null)
{
var minSize = Math.Min(metrics.WidthPixels, metrics.HeightPixels);
var isWide = minSize * metrics.Density >= tabletCrossover;
- currentIdiom = isWide ? Idioms.Tablet : Idioms.Phone;
+ currentIdiom = isWide ? DeviceIdiom.Tablet : DeviceIdiom.Phone;
}
}
@@ -72,16 +72,18 @@ static string GetIdiom()
return currentIdiom;
}
- static string DetectIdiom(UiMode uiMode)
+ static DeviceIdiom DetectIdiom(UiMode uiMode)
{
if (uiMode.HasFlag(UiMode.TypeNormal))
- return Idioms.Phone;
+ return DeviceIdiom.Phone;
else if (uiMode.HasFlag(UiMode.TypeTelevision))
- return Idioms.TV;
+ return DeviceIdiom.TV;
else if (uiMode.HasFlag(UiMode.TypeDesk))
- return Idioms.Desktop;
+ return DeviceIdiom.Desktop;
+ else if (Essentials.Platform.HasApiLevel(BuildVersionCodes.KitkatWatch) && uiMode.HasFlag(UiMode.TypeWatch))
+ return DeviceIdiom.Watch;
- return Idioms.Unsupported;
+ return DeviceIdiom.Unknown;
}
static DeviceType GetDeviceType()
diff --git a/Xamarin.Essentials/DeviceInfo/DeviceInfo.ios.cs b/Xamarin.Essentials/DeviceInfo/DeviceInfo.ios.cs
index f1195fdf4..d69098a0c 100644
--- a/Xamarin.Essentials/DeviceInfo/DeviceInfo.ios.cs
+++ b/Xamarin.Essentials/DeviceInfo/DeviceInfo.ios.cs
@@ -26,22 +26,22 @@ static string GetModel()
static string GetVersionString() => UIDevice.CurrentDevice.SystemVersion;
- static string GetPlatform() => Platforms.iOS;
+ static DevicePlatform GetPlatform() => DevicePlatform.iOS;
- static string GetIdiom()
+ static DeviceIdiom GetIdiom()
{
switch (UIDevice.CurrentDevice.UserInterfaceIdiom)
{
case UIUserInterfaceIdiom.Pad:
- return Idioms.Tablet;
+ return DeviceIdiom.Tablet;
case UIUserInterfaceIdiom.Phone:
- return Idioms.Phone;
+ return DeviceIdiom.Phone;
case UIUserInterfaceIdiom.TV:
- return Idioms.TV;
+ return DeviceIdiom.TV;
case UIUserInterfaceIdiom.CarPlay:
case UIUserInterfaceIdiom.Unspecified:
default:
- return Idioms.Unsupported;
+ return DeviceIdiom.Unknown;
}
}
diff --git a/Xamarin.Essentials/DeviceInfo/DeviceInfo.netstandard.cs b/Xamarin.Essentials/DeviceInfo/DeviceInfo.netstandard.cs
index 4e54c25f5..7c2e3cfb0 100644
--- a/Xamarin.Essentials/DeviceInfo/DeviceInfo.netstandard.cs
+++ b/Xamarin.Essentials/DeviceInfo/DeviceInfo.netstandard.cs
@@ -10,10 +10,10 @@ public static partial class DeviceInfo
static string GetVersionString() => throw new NotImplementedInReferenceAssemblyException();
- static string GetPlatform() => throw new NotImplementedInReferenceAssemblyException();
+ static DevicePlatform GetPlatform() => DevicePlatform.Unknown;
- static string GetIdiom() => throw new NotImplementedInReferenceAssemblyException();
+ static DeviceIdiom GetIdiom() => DeviceIdiom.Unknown;
- static DeviceType GetDeviceType() => throw new NotImplementedInReferenceAssemblyException();
+ static DeviceType GetDeviceType() => DeviceType.Unknown;
}
}
diff --git a/Xamarin.Essentials/DeviceInfo/DeviceInfo.shared.cs b/Xamarin.Essentials/DeviceInfo/DeviceInfo.shared.cs
index cd056839d..2aa432814 100644
--- a/Xamarin.Essentials/DeviceInfo/DeviceInfo.shared.cs
+++ b/Xamarin.Essentials/DeviceInfo/DeviceInfo.shared.cs
@@ -14,41 +14,17 @@ public static partial class DeviceInfo
public static Version Version => Utils.ParseVersion(VersionString);
- public static string Platform => GetPlatform();
+ public static DevicePlatform Platform => GetPlatform();
- public static string Idiom => GetIdiom();
+ public static DeviceIdiom Idiom => GetIdiom();
public static DeviceType DeviceType => GetDeviceType();
-
- public static class Idioms
- {
- // try to match Xamarin.Forms:
- // https://github.com/xamarin/Xamarin.Forms/blob/2.5.1/Xamarin.Forms.Core/TargetIdiom.cs
-
- public const string Phone = "Phone";
- public const string Tablet = "Tablet";
- public const string Desktop = "Desktop";
- public const string TV = "TV";
-
- public const string Unsupported = "Unsupported";
- }
-
- public static class Platforms
- {
- // try to match Xamarin.Forms:
- // https://github.com/xamarin/Xamarin.Forms/blob/2.5.1/Xamarin.Forms.Core/Device.cs#L14-L19
-
- public const string iOS = "iOS";
- public const string Android = "Android";
- public const string UWP = "UWP";
-
- public const string Unsupported = "Unsupported";
- }
}
public enum DeviceType
{
- Physical,
- Virtual
+ Unknown = 0,
+ Physical = 1,
+ Virtual = 2
}
}
diff --git a/Xamarin.Essentials/DeviceInfo/DeviceInfo.uwp.cs b/Xamarin.Essentials/DeviceInfo/DeviceInfo.uwp.cs
index 176b12964..2b027addf 100644
--- a/Xamarin.Essentials/DeviceInfo/DeviceInfo.uwp.cs
+++ b/Xamarin.Essentials/DeviceInfo/DeviceInfo.uwp.cs
@@ -1,5 +1,4 @@
-using Windows.Graphics.Display;
-using Windows.Security.ExchangeActiveSyncProvisioning;
+using Windows.Security.ExchangeActiveSyncProvisioning;
using Windows.System.Profile;
using Windows.UI.ViewManagement;
@@ -36,28 +35,28 @@ static string GetVersionString()
return version;
}
- static string GetPlatform() => Platforms.UWP;
+ static DevicePlatform GetPlatform() => DevicePlatform.UWP;
- static string GetIdiom()
+ static DeviceIdiom GetIdiom()
{
switch (AnalyticsInfo.VersionInfo.DeviceFamily)
{
case "Windows.Mobile":
- return Idioms.Phone;
+ return DeviceIdiom.Phone;
case "Windows.Universal":
case "Windows.Desktop":
{
var uiMode = UIViewSettings.GetForCurrentView().UserInteractionMode;
- return uiMode == UserInteractionMode.Mouse ? Idioms.Desktop : Idioms.Tablet;
+ return uiMode == UserInteractionMode.Mouse ? DeviceIdiom.Desktop : DeviceIdiom.Tablet;
}
case "Windows.Xbox":
case "Windows.Team":
- return Idioms.TV;
+ return DeviceIdiom.TV;
case "Windows.IoT":
- return Idioms.Unsupported;
+ return DeviceIdiom.Unknown;
}
- return Idioms.Unsupported;
+ return DeviceIdiom.Unknown;
}
static DeviceType GetDeviceType()
diff --git a/Xamarin.Essentials/Geocoding/Geocoding.shared.cs b/Xamarin.Essentials/Geocoding/Geocoding.shared.cs
index 37cd993c5..77e049d24 100644
--- a/Xamarin.Essentials/Geocoding/Geocoding.shared.cs
+++ b/Xamarin.Essentials/Geocoding/Geocoding.shared.cs
@@ -6,8 +6,6 @@ namespace Xamarin.Essentials
{
public static partial class Geocoding
{
- public static string MapKey { get; set; }
-
public static Task> GetPlacemarksAsync(Location location)
{
if (location == null)
diff --git a/Xamarin.Essentials/Geocoding/Geocoding.uwp.cs b/Xamarin.Essentials/Geocoding/Geocoding.uwp.cs
index c4d2bd5a3..aa90255c4 100644
--- a/Xamarin.Essentials/Geocoding/Geocoding.uwp.cs
+++ b/Xamarin.Essentials/Geocoding/Geocoding.uwp.cs
@@ -10,7 +10,7 @@ public static partial class Geocoding
{
static async Task> PlatformGetPlacemarksAsync(double latitude, double longitude)
{
- ValidateMapKey();
+ ValidateMapServiceToken();
var point = new Geopoint(new BasicGeoposition { Latitude = latitude, Longitude = longitude });
@@ -21,20 +21,20 @@ static async Task> PlatformGetPlacemarksAsync(double lati
static async Task> PlatformGetLocationsAsync(string address)
{
- ValidateMapKey();
+ ValidateMapServiceToken();
var queryResults = await MapLocationFinder.FindLocationsAsync(address, null, 10);
return queryResults?.Locations?.ToLocations();
}
- internal static void ValidateMapKey()
+ internal static void ValidateMapServiceToken()
{
- if (string.IsNullOrWhiteSpace(MapKey) && string.IsNullOrWhiteSpace(MapService.ServiceToken))
- throw new ArgumentNullException(nameof(MapKey));
+ if (string.IsNullOrWhiteSpace(Platform.MapServiceToken) && string.IsNullOrWhiteSpace(MapService.ServiceToken))
+ throw new ArgumentNullException(nameof(Platform.MapServiceToken));
- if (!string.IsNullOrWhiteSpace(MapKey))
- MapService.ServiceToken = MapKey;
+ if (!string.IsNullOrWhiteSpace(Platform.MapServiceToken))
+ MapService.ServiceToken = Platform.MapServiceToken;
}
}
}
diff --git a/Xamarin.Essentials/Geolocation/Geolocation.android.cs b/Xamarin.Essentials/Geolocation/Geolocation.android.cs
index 36ab090aa..290f5f5ea 100644
--- a/Xamarin.Essentials/Geolocation/Geolocation.android.cs
+++ b/Xamarin.Essentials/Geolocation/Geolocation.android.cs
@@ -134,6 +134,7 @@ void RemoveUpdates()
criteria.PowerRequirement = LocationPower.Low;
accuracyDistance = 500;
break;
+ case GeolocationAccuracy.Default:
case GeolocationAccuracy.Medium:
criteria.Accuracy = Accuracy.Coarse;
criteria.HorizontalAccuracy = Accuracy.Medium;
diff --git a/Xamarin.Essentials/Geolocation/GeolocationRequest.ios.cs b/Xamarin.Essentials/Geolocation/GeolocationRequest.ios.cs
index 72701f92a..0ed9afa10 100644
--- a/Xamarin.Essentials/Geolocation/GeolocationRequest.ios.cs
+++ b/Xamarin.Essentials/Geolocation/GeolocationRequest.ios.cs
@@ -17,6 +17,7 @@ internal double PlatformDesiredAccuracy
return CLLocation.AccuracyThreeKilometers;
case GeolocationAccuracy.Low:
return CLLocation.AccuracyKilometer;
+ case GeolocationAccuracy.Default:
case GeolocationAccuracy.Medium:
return CLLocation.AccuracyHundredMeters;
case GeolocationAccuracy.High:
diff --git a/Xamarin.Essentials/Geolocation/GeolocationRequest.shared.cs b/Xamarin.Essentials/Geolocation/GeolocationRequest.shared.cs
index 30a906f1e..67522f59b 100644
--- a/Xamarin.Essentials/Geolocation/GeolocationRequest.shared.cs
+++ b/Xamarin.Essentials/Geolocation/GeolocationRequest.shared.cs
@@ -4,30 +4,33 @@ namespace Xamarin.Essentials
{
public enum GeolocationAccuracy
{
+ // Default is Medium
+ Default = 0,
+
// iOS: ThreeKilometers (3000m)
// Android: ACCURACY_LOW, POWER_LOW (500m)
// UWP: 3000 (1000-5000m)
- Lowest,
+ Lowest = 1,
// iOS: Kilometer (1000m)
// Android: ACCURACY_LOW, POWER_MED (500m)
// UWP: 1000 (300-3000m)
- Low,
+ Low = 2,
// iOS: HundredMeters (100m)
// Android: ACCURACY_MED, POWER_MED (100-500m)
// UWP: 100 (30-500m)
- Medium,
+ Medium = 3,
// iOS: NearestTenMeters (10m)
// Android: ACCURACY_HI, POWER_MED (0-100m)
// UWP: High (<=10m)
- High,
+ High = 4,
// iOS: Best (0m)
// Android: ACCURACY_HI, POWER_HI (0-100m)
// UWP: High (<=10m)
- Best
+ Best = 5
}
public partial class GeolocationRequest
@@ -35,7 +38,7 @@ public partial class GeolocationRequest
public GeolocationRequest()
{
Timeout = TimeSpan.Zero;
- DesiredAccuracy = GeolocationAccuracy.Medium;
+ DesiredAccuracy = GeolocationAccuracy.Default;
}
public GeolocationRequest(GeolocationAccuracy accuracy)
diff --git a/Xamarin.Essentials/Geolocation/GeolocationRequest.uwp.cs b/Xamarin.Essentials/Geolocation/GeolocationRequest.uwp.cs
index dde1e50b7..b799f1032 100644
--- a/Xamarin.Essentials/Geolocation/GeolocationRequest.uwp.cs
+++ b/Xamarin.Essentials/Geolocation/GeolocationRequest.uwp.cs
@@ -16,6 +16,7 @@ internal uint PlatformDesiredAccuracy
return 3000;
case GeolocationAccuracy.Low:
return 1000;
+ case GeolocationAccuracy.Default:
case GeolocationAccuracy.Medium:
return 100;
case GeolocationAccuracy.High:
diff --git a/Xamarin.Essentials/GlobalSuppressions.shared.cs b/Xamarin.Essentials/GlobalSuppressions.shared.cs
new file mode 100644
index 000000000..5fcb8feb7
--- /dev/null
+++ b/Xamarin.Essentials/GlobalSuppressions.shared.cs
@@ -0,0 +1,7 @@
+// This file is used by Code Analysis to maintain SuppressMessage
+// attributes that are applied to this project.
+// Project-level suppressions either have no target or are given
+// a specific target and scoped to a namespace, type, member, etc.
+
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "iOS is what we want.", Scope = "member", Target = "~P:Xamarin.Essentials.DevicePlatform.iOS")]
+[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "iOS is what we want.", Scope = "member", Target = "~P:Xamarin.Essentials.DevicePlatform.iOS")]
diff --git a/Xamarin.Essentials/Gyroscope/Gyroscope.shared.cs b/Xamarin.Essentials/Gyroscope/Gyroscope.shared.cs
index 3a78b2904..ad41c35a4 100644
--- a/Xamarin.Essentials/Gyroscope/Gyroscope.shared.cs
+++ b/Xamarin.Essentials/Gyroscope/Gyroscope.shared.cs
@@ -17,10 +17,10 @@ public static void Start(SensorSpeed sensorSpeed)
throw new FeatureNotSupportedException();
if (IsMonitoring)
- return;
+ throw new InvalidOperationException("Gyroscope has already been started.");
IsMonitoring = true;
- useSyncContext = sensorSpeed == SensorSpeed.Normal || sensorSpeed == SensorSpeed.UI;
+ useSyncContext = sensorSpeed == SensorSpeed.Default || sensorSpeed == SensorSpeed.UI;
try
{
@@ -68,7 +68,7 @@ internal static void OnChanged(GyroscopeChangedEventArgs e)
public class GyroscopeChangedEventArgs : EventArgs
{
- internal GyroscopeChangedEventArgs(GyroscopeData reading) =>
+ public GyroscopeChangedEventArgs(GyroscopeData reading) =>
Reading = reading;
public GyroscopeData Reading { get; }
@@ -76,12 +76,12 @@ internal GyroscopeChangedEventArgs(GyroscopeData reading) =>
public readonly struct GyroscopeData : IEquatable
{
- internal GyroscopeData(double x, double y, double z)
+ public GyroscopeData(double x, double y, double z)
: this((float)x, (float)y, (float)z)
{
}
- internal GyroscopeData(float x, float y, float z) =>
+ public GyroscopeData(float x, float y, float z) =>
AngularVelocity = new Vector3(x, y, z);
public Vector3 AngularVelocity { get; }
diff --git a/Xamarin.Essentials/Magnetometer/Magnetometer.shared.cs b/Xamarin.Essentials/Magnetometer/Magnetometer.shared.cs
index e16e58553..504805e47 100644
--- a/Xamarin.Essentials/Magnetometer/Magnetometer.shared.cs
+++ b/Xamarin.Essentials/Magnetometer/Magnetometer.shared.cs
@@ -17,10 +17,10 @@ public static void Start(SensorSpeed sensorSpeed)
throw new FeatureNotSupportedException();
if (IsMonitoring)
- return;
+ throw new InvalidOperationException("Magnetometer has already been started.");
IsMonitoring = true;
- useSyncContext = sensorSpeed == SensorSpeed.Normal || sensorSpeed == SensorSpeed.UI;
+ useSyncContext = sensorSpeed == SensorSpeed.Default || sensorSpeed == SensorSpeed.UI;
try
{
@@ -68,7 +68,7 @@ internal static void OnChanged(MagnetometerChangedEventArgs e)
public class MagnetometerChangedEventArgs : EventArgs
{
- internal MagnetometerChangedEventArgs(MagnetometerData reading) =>
+ public MagnetometerChangedEventArgs(MagnetometerData reading) =>
Reading = reading;
public MagnetometerData Reading { get; }
@@ -76,12 +76,12 @@ internal MagnetometerChangedEventArgs(MagnetometerData reading) =>
public readonly struct MagnetometerData : IEquatable
{
- internal MagnetometerData(double x, double y, double z)
+ public MagnetometerData(double x, double y, double z)
: this((float)x, (float)y, (float)z)
{
}
- internal MagnetometerData(float x, float y, float z) =>
+ public MagnetometerData(float x, float y, float z) =>
MagneticField = new Vector3(x, y, z);
public Vector3 MagneticField { get; }
diff --git a/Xamarin.Essentials/MainThread/MainThread.uwp.cs b/Xamarin.Essentials/MainThread/MainThread.uwp.cs
index 73ccfb7c9..30170b8ea 100644
--- a/Xamarin.Essentials/MainThread/MainThread.uwp.cs
+++ b/Xamarin.Essentials/MainThread/MainThread.uwp.cs
@@ -6,8 +6,19 @@ namespace Xamarin.Essentials
{
public static partial class MainThread
{
- static bool PlatformIsMainThread =>
- CoreApplication.MainView.CoreWindow?.Dispatcher?.HasThreadAccess ?? false;
+ static bool PlatformIsMainThread
+ {
+ get
+ {
+ // if there is no main window, then this is either a service
+ // or the UI is not yet constructed, so the main thread is the
+ // current thread
+ if (CoreApplication.MainView.CoreWindow == null)
+ return true;
+
+ return CoreApplication.MainView.CoreWindow.Dispatcher?.HasThreadAccess ?? false;
+ }
+ }
static void PlatformBeginInvokeOnMainThread(Action action)
{
diff --git a/Xamarin.Essentials/Maps/Maps.android.cs b/Xamarin.Essentials/Map/Map.android.cs
similarity index 75%
rename from Xamarin.Essentials/Maps/Maps.android.cs
rename to Xamarin.Essentials/Map/Map.android.cs
index b90250ef9..a6dbf441e 100644
--- a/Xamarin.Essentials/Maps/Maps.android.cs
+++ b/Xamarin.Essentials/Map/Map.android.cs
@@ -5,15 +5,15 @@
namespace Xamarin.Essentials
{
- public static partial class Maps
+ public static partial class Map
{
- internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options)
+ internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions options)
{
var uri = string.Empty;
var lat = latitude.ToString(CultureInfo.InvariantCulture);
var lng = longitude.ToString(CultureInfo.InvariantCulture);
- if (options.MapDirectionsMode == MapDirectionsMode.None)
+ if (options.NavigationMode == NavigationMode.None)
{
uri = $"geo:{lat},{lng}?q={lat},{lng}";
@@ -22,29 +22,29 @@ internal static Task PlatformOpenMapsAsync(double latitude, double longitude, Ma
}
else
{
- uri = $"google.navigation:q={lat},{lng}{GetMode(options.MapDirectionsMode)}";
+ uri = $"google.navigation:q={lat},{lng}{GetMode(options.NavigationMode)}";
}
StartIntent(uri);
return Task.CompletedTask;
}
- internal static string GetMode(MapDirectionsMode mode)
+ internal static string GetMode(NavigationMode mode)
{
switch (mode)
{
- case MapDirectionsMode.Bicycling: return "&mode=b";
- case MapDirectionsMode.Driving: return "&mode=d";
- case MapDirectionsMode.Walking: return "&mode=w";
+ case NavigationMode.Bicycling: return "&mode=b";
+ case NavigationMode.Driving: return "&mode=d";
+ case NavigationMode.Walking: return "&mode=w";
}
return string.Empty;
}
- internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options)
+ internal static Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options)
{
placemark = placemark.Escape();
var uri = string.Empty;
- if (options.MapDirectionsMode == MapDirectionsMode.None)
+ if (options.NavigationMode == NavigationMode.None)
{
uri = $"geo:0,0?q={placemark.Thoroughfare} {placemark.Locality} {placemark.AdminArea} {placemark.PostalCode} {placemark.CountryName}";
if (!string.IsNullOrWhiteSpace(options.Name))
@@ -52,7 +52,7 @@ internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOption
}
else
{
- uri = $"google.navigation:q={placemark.Thoroughfare} {placemark.Locality} {placemark.AdminArea} {placemark.PostalCode} {placemark.CountryName}{GetMode(options.MapDirectionsMode)}";
+ uri = $"google.navigation:q={placemark.Thoroughfare} {placemark.Locality} {placemark.AdminArea} {placemark.PostalCode} {placemark.CountryName}{GetMode(options.NavigationMode)}";
}
StartIntent(uri);
diff --git a/Xamarin.Essentials/Maps/Maps.ios.cs b/Xamarin.Essentials/Map/Map.ios.cs
similarity index 82%
rename from Xamarin.Essentials/Maps/Maps.ios.cs
rename to Xamarin.Essentials/Map/Map.ios.cs
index 01c38c43b..c7a319226 100644
--- a/Xamarin.Essentials/Maps/Maps.ios.cs
+++ b/Xamarin.Essentials/Map/Map.ios.cs
@@ -7,9 +7,9 @@
namespace Xamarin.Essentials
{
- public static partial class Maps
+ public static partial class Map
{
- internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options)
+ internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions options)
{
if (string.IsNullOrWhiteSpace(options.Name))
options.Name = string.Empty;
@@ -19,7 +19,7 @@ internal static Task PlatformOpenMapsAsync(double latitude, double longitude, Ma
return OpenPlacemark(placemark, options);
}
- internal static async Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options)
+ internal static async Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options)
{
var address = new MKPlacemarkAddress
{
@@ -51,7 +51,7 @@ internal static async Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunch
await OpenPlacemark(new MKPlacemark(placemarks[0].Location.Coordinate, address), options);
}
- static Task OpenPlacemark(MKPlacemark placemark, MapsLaunchOptions options)
+ static Task OpenPlacemark(MKPlacemark placemark, MapLaunchOptions options)
{
var mapItem = new MKMapItem(placemark)
{
@@ -59,22 +59,22 @@ static Task OpenPlacemark(MKPlacemark placemark, MapsLaunchOptions options)
};
MKLaunchOptions launchOptions = null;
- if (options.MapDirectionsMode != MapDirectionsMode.None)
+ if (options.NavigationMode != NavigationMode.None)
{
var mode = MKDirectionsMode.Default;
- switch (options.MapDirectionsMode)
+ switch (options.NavigationMode)
{
- case MapDirectionsMode.Driving:
+ case NavigationMode.Driving:
mode = MKDirectionsMode.Driving;
break;
- case MapDirectionsMode.Transit:
+ case NavigationMode.Transit:
mode = MKDirectionsMode.Transit;
break;
- case MapDirectionsMode.Walking:
+ case NavigationMode.Walking:
mode = MKDirectionsMode.Walking;
break;
- case MapDirectionsMode.Default:
+ case NavigationMode.Default:
mode = MKDirectionsMode.Default;
break;
}
diff --git a/Xamarin.Essentials/Maps/Maps.netstandard.cs b/Xamarin.Essentials/Map/Map.netstandard.cs
similarity index 74%
rename from Xamarin.Essentials/Maps/Maps.netstandard.cs
rename to Xamarin.Essentials/Map/Map.netstandard.cs
index 7c315680b..8faef3e9a 100644
--- a/Xamarin.Essentials/Maps/Maps.netstandard.cs
+++ b/Xamarin.Essentials/Map/Map.netstandard.cs
@@ -2,12 +2,12 @@
namespace Xamarin.Essentials
{
- public static partial class Maps
+ public static partial class Map
{
- internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options)
+ internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions options)
=> throw new NotImplementedInReferenceAssemblyException();
- internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options)
+ internal static Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options)
=> throw new NotImplementedInReferenceAssemblyException();
}
}
diff --git a/Xamarin.Essentials/Maps/Maps.shared.cs b/Xamarin.Essentials/Map/Map.shared.cs
similarity index 72%
rename from Xamarin.Essentials/Maps/Maps.shared.cs
rename to Xamarin.Essentials/Map/Map.shared.cs
index 4971c2f84..b5494976e 100644
--- a/Xamarin.Essentials/Maps/Maps.shared.cs
+++ b/Xamarin.Essentials/Map/Map.shared.cs
@@ -3,12 +3,12 @@
namespace Xamarin.Essentials
{
- public static partial class Maps
+ public static partial class Map
{
public static Task OpenAsync(Location location) =>
- OpenAsync(location, new MapsLaunchOptions());
+ OpenAsync(location, new MapLaunchOptions());
- public static Task OpenAsync(Location location, MapsLaunchOptions options)
+ public static Task OpenAsync(Location location, MapLaunchOptions options)
{
if (location == null)
throw new ArgumentNullException(nameof(location));
@@ -20,9 +20,9 @@ public static Task OpenAsync(Location location, MapsLaunchOptions options)
}
public static Task OpenAsync(double latitude, double longitude) =>
- OpenAsync(latitude, longitude, new MapsLaunchOptions());
+ OpenAsync(latitude, longitude, new MapLaunchOptions());
- public static Task OpenAsync(double latitude, double longitude, MapsLaunchOptions options)
+ public static Task OpenAsync(double latitude, double longitude, MapLaunchOptions options)
{
if (options == null)
throw new ArgumentNullException(nameof(options));
@@ -31,9 +31,9 @@ public static Task OpenAsync(double latitude, double longitude, MapsLaunchOption
}
public static Task OpenAsync(Placemark placemark) =>
- OpenAsync(placemark, new MapsLaunchOptions());
+ OpenAsync(placemark, new MapLaunchOptions());
- public static Task OpenAsync(Placemark placemark, MapsLaunchOptions options)
+ public static Task OpenAsync(Placemark placemark, MapLaunchOptions options)
{
if (placemark == null)
throw new ArgumentNullException(nameof(placemark));
diff --git a/Xamarin.Essentials/Maps/Maps.uwp.cs b/Xamarin.Essentials/Map/Map.uwp.cs
similarity index 74%
rename from Xamarin.Essentials/Maps/Maps.uwp.cs
rename to Xamarin.Essentials/Map/Map.uwp.cs
index 101708e5d..a52c51666 100644
--- a/Xamarin.Essentials/Maps/Maps.uwp.cs
+++ b/Xamarin.Essentials/Map/Map.uwp.cs
@@ -4,44 +4,44 @@
namespace Xamarin.Essentials
{
- public static partial class Maps
+ public static partial class Map
{
- internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapsLaunchOptions options)
+ internal static Task PlatformOpenMapsAsync(double latitude, double longitude, MapLaunchOptions options)
{
var lat = latitude.ToString(CultureInfo.InvariantCulture);
var lng = longitude.ToString(CultureInfo.InvariantCulture);
var name = options.Name ?? string.Empty;
var uri = string.Empty;
- if (options.MapDirectionsMode == MapDirectionsMode.None)
+ if (options.NavigationMode == NavigationMode.None)
{
uri = $"bingmaps:?collection=point.{lat}_{lng}_{name}";
}
else
{
- uri = $"bingmaps:?rtp=~pos.{lat}_{lng}_{name}{GetMode(options.MapDirectionsMode)}";
+ uri = $"bingmaps:?rtp=~pos.{lat}_{lng}_{name}{GetMode(options.NavigationMode)}";
}
return LaunchUri(new Uri(uri));
}
- internal static string GetMode(MapDirectionsMode mode)
+ internal static string GetMode(NavigationMode mode)
{
switch (mode)
{
- case MapDirectionsMode.Driving: return "&mode=d";
- case MapDirectionsMode.Transit: return "&mode=t";
- case MapDirectionsMode.Walking: return "&mode=w";
+ case NavigationMode.Driving: return "&mode=d";
+ case NavigationMode.Transit: return "&mode=t";
+ case NavigationMode.Walking: return "&mode=w";
}
return string.Empty;
}
- internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOptions options)
+ internal static Task PlatformOpenMapsAsync(Placemark placemark, MapLaunchOptions options)
{
placemark = placemark.Escape();
var uri = string.Empty;
- if (options.MapDirectionsMode == MapDirectionsMode.None)
+ if (options.NavigationMode == NavigationMode.None)
{
uri = $"bingmaps:?where=" +
$"{placemark.Thoroughfare}" +
@@ -58,7 +58,7 @@ internal static Task PlatformOpenMapsAsync(Placemark placemark, MapsLaunchOption
$"%20{placemark.AdminArea}" +
$"%20{placemark.PostalCode}" +
$"%20{placemark.CountryName}" +
- $"{GetMode(options.MapDirectionsMode)}";
+ $"{GetMode(options.NavigationMode)}";
}
return LaunchUri(new Uri(uri));
diff --git a/Xamarin.Essentials/Map/MapLaunchOptions.shared.cs b/Xamarin.Essentials/Map/MapLaunchOptions.shared.cs
new file mode 100644
index 000000000..a2cfe4739
--- /dev/null
+++ b/Xamarin.Essentials/Map/MapLaunchOptions.shared.cs
@@ -0,0 +1,9 @@
+namespace Xamarin.Essentials
+{
+ public class MapLaunchOptions
+ {
+ public NavigationMode NavigationMode { get; set; } = NavigationMode.None;
+
+ public string Name { get; set; } = string.Empty;
+ }
+}
diff --git a/Xamarin.Essentials/Map/NavigationMode.shared.cs b/Xamarin.Essentials/Map/NavigationMode.shared.cs
new file mode 100644
index 000000000..3176aaac7
--- /dev/null
+++ b/Xamarin.Essentials/Map/NavigationMode.shared.cs
@@ -0,0 +1,12 @@
+namespace Xamarin.Essentials
+{
+ public enum NavigationMode
+ {
+ None = 0,
+ Default = 1,
+ Bicycling = 2,
+ Driving = 3,
+ Transit = 4,
+ Walking = 5,
+ }
+}
diff --git a/Xamarin.Essentials/Maps/MapDirectionsMode.shared.cs b/Xamarin.Essentials/Maps/MapDirectionsMode.shared.cs
deleted file mode 100644
index 7c0a9c246..000000000
--- a/Xamarin.Essentials/Maps/MapDirectionsMode.shared.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Xamarin.Essentials
-{
- public enum MapDirectionsMode
- {
- None,
- Bicycling,
- Default,
- Driving,
- Transit,
- Walking,
- }
-}
diff --git a/Xamarin.Essentials/Maps/MapLaunchOptions.shared.cs b/Xamarin.Essentials/Maps/MapLaunchOptions.shared.cs
deleted file mode 100644
index 64442d539..000000000
--- a/Xamarin.Essentials/Maps/MapLaunchOptions.shared.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Xamarin.Essentials
-{
- public class MapsLaunchOptions
- {
- public MapDirectionsMode MapDirectionsMode { get; set; } = MapDirectionsMode.None;
-
- public string Name { get; set; } = string.Empty;
- }
-}
diff --git a/Xamarin.Essentials/OrientationSensor/OrientationSensor.shared.cs b/Xamarin.Essentials/OrientationSensor/OrientationSensor.shared.cs
index 4badd4dcc..a72b8a1a9 100644
--- a/Xamarin.Essentials/OrientationSensor/OrientationSensor.shared.cs
+++ b/Xamarin.Essentials/OrientationSensor/OrientationSensor.shared.cs
@@ -17,10 +17,10 @@ public static void Start(SensorSpeed sensorSpeed)
throw new FeatureNotSupportedException();
if (IsMonitoring)
- return;
+ throw new InvalidOperationException("Orientation sensor has already been started.");
IsMonitoring = true;
- useSyncContext = sensorSpeed == SensorSpeed.Normal || sensorSpeed == SensorSpeed.UI;
+ useSyncContext = sensorSpeed == SensorSpeed.Default || sensorSpeed == SensorSpeed.UI;
try
{
@@ -68,7 +68,7 @@ internal static void OnChanged(OrientationSensorChangedEventArgs e)
public class OrientationSensorChangedEventArgs : EventArgs
{
- internal OrientationSensorChangedEventArgs(OrientationSensorData reading) =>
+ public OrientationSensorChangedEventArgs(OrientationSensorData reading) =>
Reading = reading;
public OrientationSensorData Reading { get; }
@@ -76,12 +76,12 @@ internal OrientationSensorChangedEventArgs(OrientationSensorData reading) =>
public readonly struct OrientationSensorData : IEquatable
{
- internal OrientationSensorData(double x, double y, double z, double w)
+ public OrientationSensorData(double x, double y, double z, double w)
: this((float)x, (float)y, (float)z, (float)w)
{
}
- internal OrientationSensorData(float x, float y, float z, float w) =>
+ public OrientationSensorData(float x, float y, float z, float w) =>
Orientation = new Quaternion(x, y, z, w);
public Quaternion Orientation { get; }
diff --git a/Xamarin.Essentials/PhoneDialer/PhoneDialer.ios.cs b/Xamarin.Essentials/PhoneDialer/PhoneDialer.ios.cs
index 025eed4ec..ae1d8c2c8 100644
--- a/Xamarin.Essentials/PhoneDialer/PhoneDialer.ios.cs
+++ b/Xamarin.Essentials/PhoneDialer/PhoneDialer.ios.cs
@@ -9,22 +9,7 @@ public static partial class PhoneDialer
{
const string noNetworkProviderCode = "65535";
- internal static bool IsSupported
- {
- get
- {
- var isDialerInstalled = UIApplication.SharedApplication.CanOpenUrl(CreateNsUrl(new string('0', 10)));
-
- if (!isDialerInstalled)
- return false;
-
- using (var netInfo = new CTTelephonyNetworkInfo())
- {
- var mnc = netInfo.SubscriberCellularProvider?.MobileNetworkCode;
- return !string.IsNullOrEmpty(mnc) && mnc != noNetworkProviderCode;
- }
- }
- }
+ internal static bool IsSupported => UIApplication.SharedApplication.CanOpenUrl(CreateNsUrl(new string('0', 10)));
static void PlatformOpen(string number)
{
diff --git a/Xamarin.Essentials/Platform/Platform.shared.cs b/Xamarin.Essentials/Platform/Platform.shared.cs
index 871d3e02e..b946b4c87 100644
--- a/Xamarin.Essentials/Platform/Platform.shared.cs
+++ b/Xamarin.Essentials/Platform/Platform.shared.cs
@@ -1,6 +1,8 @@
namespace Xamarin.Essentials
{
+#if !NETSTANDARD
public static partial class Platform
{
}
+#endif
}
diff --git a/Xamarin.Essentials/Platform/Platform.uwp.cs b/Xamarin.Essentials/Platform/Platform.uwp.cs
index 871d3e02e..0cab32217 100644
--- a/Xamarin.Essentials/Platform/Platform.uwp.cs
+++ b/Xamarin.Essentials/Platform/Platform.uwp.cs
@@ -2,5 +2,6 @@
{
public static partial class Platform
{
+ public static string MapServiceToken { get; set; }
}
}
diff --git a/Xamarin.Essentials/Power/Power.android.cs b/Xamarin.Essentials/Power/Power.android.cs
deleted file mode 100644
index 2c5e8c0db..000000000
--- a/Xamarin.Essentials/Power/Power.android.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using Android.Content;
-using Android.OS;
-using Debug = System.Diagnostics.Debug;
-
-namespace Xamarin.Essentials
-{
- public static partial class Power
- {
- static PowerBroadcastReceiver powerReceiver;
-
- static void StartPowerListeners()
- {
- if (!Platform.HasApiLevel(BuildVersionCodes.Lollipop))
- return;
-
- powerReceiver = new PowerBroadcastReceiver(OnPowerChanged);
- Platform.AppContext.RegisterReceiver(powerReceiver, new IntentFilter(PowerManager.ActionPowerSaveModeChanged));
- }
-
- static void StopPowerListeners()
- {
- if (!Platform.HasApiLevel(BuildVersionCodes.Lollipop))
- return;
-
- try
- {
- Platform.AppContext.UnregisterReceiver(powerReceiver);
- }
- catch (Java.Lang.IllegalArgumentException)
- {
- Debug.WriteLine("Power receiver already unregistered. Disposing of it.");
- }
- powerReceiver.Dispose();
- powerReceiver = null;
- }
-
- static EnergySaverStatus PlatformEnergySaverStatus
- {
- get
- {
- var status = false;
- if (Platform.HasApiLevel(BuildVersionCodes.Lollipop))
- status = Platform.PowerManager?.IsPowerSaveMode ?? false;
-
- return status ? EnergySaverStatus.On : EnergySaverStatus.Off;
- }
- }
- }
-
- [BroadcastReceiver(Enabled = true, Exported = false, Label = "Essentials Power Broadcast Receiver")]
- class PowerBroadcastReceiver : BroadcastReceiver
- {
- Action onChanged;
-
- public PowerBroadcastReceiver()
- {
- }
-
- public PowerBroadcastReceiver(Action onChanged) =>
- this.onChanged = onChanged;
-
- public override void OnReceive(Context context, Intent intent) =>
- onChanged?.Invoke();
- }
-}
diff --git a/Xamarin.Essentials/Power/Power.ios.cs b/Xamarin.Essentials/Power/Power.ios.cs
deleted file mode 100644
index 8901e992d..000000000
--- a/Xamarin.Essentials/Power/Power.ios.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using Foundation;
-using UIKit;
-
-namespace Xamarin.Essentials
-{
- public static partial class Power
- {
- static NSObject saverStatusObserver;
-
- static void StartPowerListeners()
- {
- saverStatusObserver = NSNotificationCenter.DefaultCenter.AddObserver(NSProcessInfo.PowerStateDidChangeNotification, PowerChangedNotification);
- }
-
- static void StopPowerListeners()
- {
- saverStatusObserver?.Dispose();
- saverStatusObserver = null;
- }
-
- static void PowerChangedNotification(NSNotification notification)
- => MainThread.BeginInvokeOnMainThread(OnPowerChanged);
-
- static EnergySaverStatus PlatformEnergySaverStatus =>
- NSProcessInfo.ProcessInfo?.LowPowerModeEnabled == true ? EnergySaverStatus.On : EnergySaverStatus.Off;
- }
-}
diff --git a/Xamarin.Essentials/Power/Power.netstandard.cs b/Xamarin.Essentials/Power/Power.netstandard.cs
deleted file mode 100644
index 3d36439a2..000000000
--- a/Xamarin.Essentials/Power/Power.netstandard.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace Xamarin.Essentials
-{
- public static partial class Power
- {
- static void StartPowerListeners() =>
- throw new NotImplementedInReferenceAssemblyException();
-
- static void StopPowerListeners() =>
- throw new NotImplementedInReferenceAssemblyException();
-
- static EnergySaverStatus PlatformEnergySaverStatus =>
- throw new NotImplementedInReferenceAssemblyException();
- }
-}
diff --git a/Xamarin.Essentials/Power/Power.shared.cs b/Xamarin.Essentials/Power/Power.shared.cs
deleted file mode 100644
index f22a93ec3..000000000
--- a/Xamarin.Essentials/Power/Power.shared.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System;
-
-namespace Xamarin.Essentials
-{
- public static partial class Power
- {
- static event EventHandler EnergySaverStatusChangedInternal;
-
- public static EnergySaverStatus EnergySaverStatus => PlatformEnergySaverStatus;
-
- public static event EventHandler EnergySaverStatusChanged
- {
- add
- {
- var wasRunning = EnergySaverStatusChangedInternal != null;
-
- EnergySaverStatusChangedInternal += value;
-
- if (!wasRunning && EnergySaverStatusChangedInternal != null)
- StartPowerListeners();
- }
-
- remove
- {
- var wasRunning = EnergySaverStatusChangedInternal != null;
-
- EnergySaverStatusChangedInternal -= value;
-
- if (wasRunning && EnergySaverStatusChangedInternal == null)
- StopPowerListeners();
- }
- }
-
- static void OnPowerChanged()
- => OnPowerChanged(EnergySaverStatus);
-
- static void OnPowerChanged(EnergySaverStatus saverStatus)
- => OnPowerChanged(new EnergySaverStatusChangedEventArgs(saverStatus));
-
- static void OnPowerChanged(EnergySaverStatusChangedEventArgs e)
- => EnergySaverStatusChangedInternal?.Invoke(null, e);
- }
-
- public enum EnergySaverStatus
- {
- Unknown,
- On,
- Off
- }
-
- public class EnergySaverStatusChangedEventArgs : EventArgs
- {
- internal EnergySaverStatusChangedEventArgs(EnergySaverStatus saverStatus)
- {
- EnergySaverStatus = saverStatus;
- }
-
- public EnergySaverStatus EnergySaverStatus { get; }
- }
-}
diff --git a/Xamarin.Essentials/Power/Power.uwp.cs b/Xamarin.Essentials/Power/Power.uwp.cs
deleted file mode 100644
index 1f921e484..000000000
--- a/Xamarin.Essentials/Power/Power.uwp.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Windows.System.Power;
-
-namespace Xamarin.Essentials
-{
- public static partial class Power
- {
- static void StartPowerListeners()
- {
- PowerManager.EnergySaverStatusChanged += ReportUpdated;
- }
-
- static void StopPowerListeners()
- {
- PowerManager.EnergySaverStatusChanged -= ReportUpdated;
- }
-
- static void ReportUpdated(object sender, object e)
- => MainThread.BeginInvokeOnMainThread(OnPowerChanged);
-
- static EnergySaverStatus PlatformEnergySaverStatus =>
- PowerManager.EnergySaverStatus == Windows.System.Power.EnergySaverStatus.On ? EnergySaverStatus.On : EnergySaverStatus.Off;
- }
-}
diff --git a/Xamarin.Essentials/ScreenLock/ScreenLock.android.cs b/Xamarin.Essentials/ScreenLock/ScreenLock.android.cs
deleted file mode 100644
index 3d2a8b22c..000000000
--- a/Xamarin.Essentials/ScreenLock/ScreenLock.android.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Android.Views;
-
-namespace Xamarin.Essentials
-{
- public static partial class ScreenLock
- {
- static bool PlatformIsActive
- {
- get
- {
- var activity = Platform.GetCurrentActivity(true);
- var flags = activity.Window?.Attributes?.Flags ?? 0;
- return flags.HasFlag(WindowManagerFlags.KeepScreenOn);
- }
- }
-
- static void PlatformRequestActive()
- {
- var activity = Platform.GetCurrentActivity(true);
- activity.Window?.AddFlags(WindowManagerFlags.KeepScreenOn);
- }
-
- static void PlatformRequestRelease()
- {
- var activity = Platform.GetCurrentActivity(true);
- activity.Window?.ClearFlags(WindowManagerFlags.KeepScreenOn);
- }
- }
-}
diff --git a/Xamarin.Essentials/ScreenLock/ScreenLock.ios.cs b/Xamarin.Essentials/ScreenLock/ScreenLock.ios.cs
deleted file mode 100644
index 9a77fce82..000000000
--- a/Xamarin.Essentials/ScreenLock/ScreenLock.ios.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using UIKit;
-
-namespace Xamarin.Essentials
-{
- public static partial class ScreenLock
- {
- static bool PlatformIsActive
- => UIApplication.SharedApplication.IdleTimerDisabled;
-
- static void PlatformRequestActive()
- => UIApplication.SharedApplication.IdleTimerDisabled = true;
-
- static void PlatformRequestRelease()
- => UIApplication.SharedApplication.IdleTimerDisabled = false;
- }
-}
diff --git a/Xamarin.Essentials/ScreenLock/ScreenLock.netstandard.cs b/Xamarin.Essentials/ScreenLock/ScreenLock.netstandard.cs
deleted file mode 100644
index 32472196c..000000000
--- a/Xamarin.Essentials/ScreenLock/ScreenLock.netstandard.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace Xamarin.Essentials
-{
- public static partial class ScreenLock
- {
- static bool PlatformIsActive
- => throw new NotImplementedInReferenceAssemblyException();
-
- static void PlatformRequestActive()
- => throw new NotImplementedInReferenceAssemblyException();
-
- static void PlatformRequestRelease()
- => throw new NotImplementedInReferenceAssemblyException();
- }
-}
diff --git a/Xamarin.Essentials/ScreenLock/ScreenLock.shared.cs b/Xamarin.Essentials/ScreenLock/ScreenLock.shared.cs
deleted file mode 100644
index 9c4cdf64e..000000000
--- a/Xamarin.Essentials/ScreenLock/ScreenLock.shared.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Xamarin.Essentials
-{
- public static partial class ScreenLock
- {
- public static bool IsActive => PlatformIsActive;
-
- public static void RequestActive() => PlatformRequestActive();
-
- public static void RequestRelease() => PlatformRequestRelease();
- }
-}
diff --git a/Xamarin.Essentials/ScreenLock/ScreenLock.uwp.cs b/Xamarin.Essentials/ScreenLock/ScreenLock.uwp.cs
deleted file mode 100644
index ba4a540d7..000000000
--- a/Xamarin.Essentials/ScreenLock/ScreenLock.uwp.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using Windows.System.Display;
-
-namespace Xamarin.Essentials
-{
- public static partial class ScreenLock
- {
- static readonly object locker = new object();
- static DisplayRequest displayRequest;
-
- static bool PlatformIsActive
- {
- get
- {
- lock (locker)
- {
- return displayRequest != null;
- }
- }
- }
-
- static void PlatformRequestActive()
- {
- lock (locker)
- {
- if (displayRequest == null)
- {
- displayRequest = new DisplayRequest();
- displayRequest.RequestActive();
- }
- }
- }
-
- static void PlatformRequestRelease()
- {
- lock (locker)
- {
- if (displayRequest != null)
- {
- displayRequest.RequestRelease();
- displayRequest = null;
- }
- }
- }
- }
-}
diff --git a/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs b/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs
index 20fde9c2c..1c5b0b84b 100644
--- a/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs
+++ b/Xamarin.Essentials/SecureStorage/SecureStorage.android.cs
@@ -33,7 +33,7 @@ static Task PlatformGetAsync(string key)
catch (AEADBadTagException)
{
System.Diagnostics.Debug.WriteLine($"Unable to decrypt key, {key}, which is likely due to an app uninstall. Removing old key and returning null.");
- PlatformRemove(key);
+ Remove(key);
}
}
@@ -88,13 +88,13 @@ internal AndroidKeyStore(Context context, string keystoreAlias, bool alwaysUseAs
keyStore.Load(null);
}
- Context appContext;
- string alias;
- KeyStore keyStore;
- bool alwaysUseAsymmetricKey;
+ readonly Context appContext;
+ readonly string alias;
+ readonly bool alwaysUseAsymmetricKey;
+ readonly string useSymmetricPreferenceKey = "essentials_use_symmetric";
+ KeyStore keyStore;
bool useSymmetric = false;
- string useSymmetricPreferenceKey = "essentials_use_symmetric";
ISecretKey GetKey()
{
@@ -122,24 +122,38 @@ ISecretKey GetKey()
if (!string.IsNullOrEmpty(existingKeyStr))
{
- var wrappedKey = Convert.FromBase64String(existingKeyStr);
+ try
+ {
+ var wrappedKey = Convert.FromBase64String(existingKeyStr);
- var unwrappedKey = UnwrapKey(wrappedKey, keyPair.Private);
- var kp = unwrappedKey.JavaCast();
+ var unwrappedKey = UnwrapKey(wrappedKey, keyPair.Private);
+ var kp = unwrappedKey.JavaCast();
- return kp;
+ return kp;
+ }
+ catch (InvalidKeyException ikEx)
+ {
+ System.Diagnostics.Debug.WriteLine($"Unable to unwrap key: Invalid Key. This may be caused by system backup or upgrades. All secure storage items will now be removed. {ikEx.Message}");
+ }
+ catch (IllegalBlockSizeException ibsEx)
+ {
+ System.Diagnostics.Debug.WriteLine($"Unable to unwrap key: Illegal Block Size. This may be caused by system backup or upgrades. All secure storage items will now be removed. {ibsEx.Message}");
+ }
+ catch (BadPaddingException paddingEx)
+ {
+ System.Diagnostics.Debug.WriteLine($"Unable to unwrap key: Bad Padding. This may be caused by system backup or upgrades. All secure storage items will now be removed. {paddingEx.Message}");
+ }
+ SecureStorage.RemoveAll();
}
- else
- {
- var keyGenerator = KeyGenerator.GetInstance(aesAlgorithm);
- var defSymmetricKey = keyGenerator.GenerateKey();
- var wrappedKey = WrapKey(defSymmetricKey, keyPair.Public);
+ var keyGenerator = KeyGenerator.GetInstance(aesAlgorithm);
+ var defSymmetricKey = keyGenerator.GenerateKey();
- Preferences.Set(prefsMasterKey, Convert.ToBase64String(wrappedKey), alias);
+ var newWrappedKey = WrapKey(defSymmetricKey, keyPair.Public);
- return defSymmetricKey;
- }
+ Preferences.Set(prefsMasterKey, Convert.ToBase64String(newWrappedKey), alias);
+
+ return defSymmetricKey;
}
// API 23+ Only
@@ -236,6 +250,7 @@ internal byte[] Encrypt(string data)
// Generate initialization vector
var iv = new byte[initializationVectorLen];
+
var sr = new SecureRandom();
sr.NextBytes(iv);
@@ -247,7 +262,7 @@ internal byte[] Encrypt(string data)
cipher = Cipher.GetInstance(cipherTransformationSymmetric);
cipher.Init(CipherMode.EncryptMode, key, new GCMParameterSpec(128, iv));
}
- catch (Java.Security.InvalidAlgorithmParameterException)
+ catch (InvalidAlgorithmParameterException)
{
// If we encounter this error, it's likely an old bouncycastle provider version
// is being used which does not recognize GCMParameterSpec, but should work
@@ -288,7 +303,7 @@ internal string Decrypt(byte[] data)
cipher = Cipher.GetInstance(cipherTransformationSymmetric);
cipher.Init(CipherMode.DecryptMode, key, new GCMParameterSpec(128, iv));
}
- catch (Java.Security.InvalidAlgorithmParameterException)
+ catch (InvalidAlgorithmParameterException)
{
// If we encounter this error, it's likely an old bouncycastle provider version
// is being used which does not recognize GCMParameterSpec, but should work
diff --git a/Xamarin.Essentials/TextToSpeech/TextToSpeech.android.cs b/Xamarin.Essentials/TextToSpeech/TextToSpeech.android.cs
index dcb75e45f..cce3d684c 100644
--- a/Xamarin.Essentials/TextToSpeech/TextToSpeech.android.cs
+++ b/Xamarin.Essentials/TextToSpeech/TextToSpeech.android.cs
@@ -29,7 +29,7 @@ static TextToSpeechImplementation GetTextToSpeech()
return tts;
}
- internal static Task PlatformSpeakAsync(string text, SpeakSettings settings, CancellationToken cancelToken = default)
+ internal static Task PlatformSpeakAsync(string text, SpeechOptions options, CancellationToken cancelToken = default)
{
var textToSpeech = GetTextToSpeech();
@@ -40,7 +40,7 @@ internal static Task PlatformSpeakAsync(string text, SpeakSettings settings, Can
if (Platform.HasApiLevel(BuildVersionCodes.JellyBeanMr2))
max = AndroidTextToSpeech.MaxSpeechInputLength;
- return textToSpeech.SpeakAsync(text, max, settings, cancelToken);
+ return textToSpeech.SpeakAsync(text, max, options, cancelToken);
}
internal static Task> PlatformGetLocalesAsync()
@@ -101,7 +101,7 @@ protected override void Dispose(bool disposing)
int numExpectedUtterances = 0;
int numCompletedUtterances = 0;
- public async Task SpeakAsync(string text, int max, SpeakSettings settings, CancellationToken cancelToken)
+ public async Task SpeakAsync(string text, int max, SpeechOptions options, CancellationToken cancelToken)
{
await Initialize();
@@ -125,13 +125,13 @@ public async Task SpeakAsync(string text, int max, SpeakSettings settings, Cance
});
}
- if (settings?.Locale?.Language != null)
+ if (options?.Locale?.Language != null)
{
JavaLocale locale = null;
- if (!string.IsNullOrWhiteSpace(settings?.Locale.Country))
- locale = new JavaLocale(settings.Locale.Language, settings.Locale.Country);
+ if (!string.IsNullOrWhiteSpace(options?.Locale.Country))
+ locale = new JavaLocale(options.Locale.Language, options.Locale.Country);
else
- locale = new JavaLocale(settings.Locale.Language);
+ locale = new JavaLocale(options.Locale.Language);
tts.SetLanguage(locale);
}
@@ -140,8 +140,8 @@ public async Task SpeakAsync(string text, int max, SpeakSettings settings, Cance
SetDefaultLanguage();
}
- if (settings?.Pitch.HasValue ?? false)
- tts.SetPitch(settings.Pitch.Value);
+ if (options?.Pitch.HasValue ?? false)
+ tts.SetPitch(options.Pitch.Value);
else
tts.SetPitch(TextToSpeech.PitchDefault);
@@ -160,8 +160,8 @@ public async Task SpeakAsync(string text, int max, SpeakSettings settings, Cance
{ AndroidTextToSpeech.Engine.KeyParamUtteranceId, $"{guid}.{i}" }
};
- if (settings != null && settings.Volume.HasValue)
- map.Add(AndroidTextToSpeech.Engine.KeyParamVolume, settings.Volume.Value.ToString(CultureInfo.InvariantCulture));
+ if (options != null && options.Volume.HasValue)
+ map.Add(AndroidTextToSpeech.Engine.KeyParamVolume, options.Volume.Value.ToString(CultureInfo.InvariantCulture));
// We use an obsolete overload here so it works on older API levels at runtime
// Flush on first entry and add (to not flush our own previous) subsequent entries
diff --git a/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.cs b/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.cs
index 9cd2029ed..fbe76b9ab 100644
--- a/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.cs
+++ b/Xamarin.Essentials/TextToSpeech/TextToSpeech.ios.cs
@@ -12,30 +12,30 @@ 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, SpeakSettings settings, CancellationToken cancelToken = default)
+ internal static Task PlatformSpeakAsync(string text, SpeechOptions options, CancellationToken cancelToken = default)
{
- var speechUtterance = GetSpeechUtterance(text, settings);
+ var speechUtterance = GetSpeechUtterance(text, options);
return SpeakUtterance(speechUtterance, cancelToken);
}
- private static AVSpeechUtterance GetSpeechUtterance(string text, SpeakSettings settings)
+ private static AVSpeechUtterance GetSpeechUtterance(string text, SpeechOptions options)
{
var speechUtterance = new AVSpeechUtterance(text);
- if (settings != null)
+ if (options != null)
{
// null voice if fine - it is the default
speechUtterance.Voice =
- AVSpeechSynthesisVoice.FromLanguage(settings.Locale?.Language) ??
+ AVSpeechSynthesisVoice.FromLanguage(options.Locale?.Language) ??
AVSpeechSynthesisVoice.FromLanguage(AVSpeechSynthesisVoice.CurrentLanguageCode);
// the platform has a range of 0.5 - 2.0
// anything lower than 0.5 is set to 0.5
- if (settings.Pitch.HasValue)
- speechUtterance.PitchMultiplier = settings.Pitch.Value;
+ if (options.Pitch.HasValue)
+ speechUtterance.PitchMultiplier = options.Pitch.Value;
- if (settings.Volume.HasValue)
- speechUtterance.Volume = settings.Volume.Value;
+ if (options.Volume.HasValue)
+ speechUtterance.Volume = options.Volume.Value;
}
return speechUtterance;
diff --git a/Xamarin.Essentials/TextToSpeech/TextToSpeech.netstandard.cs b/Xamarin.Essentials/TextToSpeech/TextToSpeech.netstandard.cs
index 38524b180..36ccf9fb9 100644
--- a/Xamarin.Essentials/TextToSpeech/TextToSpeech.netstandard.cs
+++ b/Xamarin.Essentials/TextToSpeech/TextToSpeech.netstandard.cs
@@ -6,7 +6,7 @@ namespace Xamarin.Essentials
{
public static partial class TextToSpeech
{
- internal static Task PlatformSpeakAsync(string text, SpeakSettings settings, CancellationToken cancelToken = default) =>
+ internal static Task PlatformSpeakAsync(string text, SpeechOptions options, CancellationToken cancelToken = default) =>
throw new NotImplementedInReferenceAssemblyException();
internal static Task> PlatformGetLocalesAsync() =>
diff --git a/Xamarin.Essentials/TextToSpeech/TextToSpeech.shared.cs b/Xamarin.Essentials/TextToSpeech/TextToSpeech.shared.cs
index 3cb745e79..9219fd720 100644
--- a/Xamarin.Essentials/TextToSpeech/TextToSpeech.shared.cs
+++ b/Xamarin.Essentials/TextToSpeech/TextToSpeech.shared.cs
@@ -23,20 +23,20 @@ public static Task> GetLocalesAsync() =>
public static Task SpeakAsync(string text, CancellationToken cancelToken = default) =>
SpeakAsync(text, default, cancelToken);
- public static async Task SpeakAsync(string text, SpeakSettings settings, CancellationToken cancelToken = default)
+ public static async Task SpeakAsync(string text, SpeechOptions options, CancellationToken cancelToken = default)
{
if (string.IsNullOrEmpty(text))
throw new ArgumentNullException(nameof(text), "Text cannot be null or empty string");
- if (settings?.Volume.HasValue ?? false)
+ if (options?.Volume.HasValue ?? false)
{
- if (settings.Volume.Value < VolumeMin || settings.Volume.Value > VolumeMax)
+ if (options.Volume.Value < VolumeMin || options.Volume.Value > VolumeMax)
throw new ArgumentOutOfRangeException($"Volume must be >= {VolumeMin} and <= {VolumeMax}");
}
- if (settings?.Pitch.HasValue ?? false)
+ if (options?.Pitch.HasValue ?? false)
{
- if (settings.Pitch.Value < PitchMin || settings.Pitch.Value > PitchMax)
+ if (options.Pitch.Value < PitchMin || options.Pitch.Value > PitchMax)
throw new ArgumentOutOfRangeException($"Pitch must be >= {PitchMin} and <= {PitchMin}");
}
@@ -46,7 +46,7 @@ public static async Task SpeakAsync(string text, SpeakSettings settings, Cancell
try
{
await semaphore.WaitAsync(cancelToken);
- await PlatformSpeakAsync(text, settings, cancelToken);
+ await PlatformSpeakAsync(text, options, cancelToken);
}
finally
{
@@ -82,7 +82,7 @@ internal Locale(string language, string country, string name, string id)
}
}
- public class SpeakSettings
+ public class SpeechOptions
{
public Locale Locale { get; set; }
diff --git a/Xamarin.Essentials/TextToSpeech/TextToSpeech.uwp.cs b/Xamarin.Essentials/TextToSpeech/TextToSpeech.uwp.cs
index e2228a710..dd8e21677 100644
--- a/Xamarin.Essentials/TextToSpeech/TextToSpeech.uwp.cs
+++ b/Xamarin.Essentials/TextToSpeech/TextToSpeech.uwp.cs
@@ -17,7 +17,7 @@ public static partial class TextToSpeech
internal static Task> PlatformGetLocalesAsync() =>
Task.FromResult(SpeechSynthesizer.AllVoices.Select(v => new Locale(v.Language, null, v.DisplayName, v.Id)));
- internal static async Task PlatformSpeakAsync(string text, SpeakSettings settings, CancellationToken cancelToken = default)
+ internal static async Task PlatformSpeakAsync(string text, SpeechOptions options, CancellationToken cancelToken = default)
{
var tcsUtterance = new TaskCompletionSource();
@@ -25,13 +25,13 @@ internal static async Task PlatformSpeakAsync(string text, SpeakSettings setting
{
var player = new MediaPlayer();
- var ssml = GetSpeakParametersSSMLProsody(text, settings);
+ var ssml = GetSpeakParametersSSMLProsody(text, options);
var speechSynthesizer = new SpeechSynthesizer();
- if (!string.IsNullOrWhiteSpace(settings?.Locale?.Id))
+ if (!string.IsNullOrWhiteSpace(options?.Locale?.Id))
{
- var voiceInfo = SpeechSynthesizer.AllVoices.FirstOrDefault(v => v.Id == settings.Locale.Id) ?? SpeechSynthesizer.DefaultVoice;
+ var voiceInfo = SpeechSynthesizer.AllVoices.FirstOrDefault(v => v.Id == options.Locale.Id) ?? SpeechSynthesizer.DefaultVoice;
speechSynthesizer.Voice = voiceInfo;
}
@@ -67,20 +67,20 @@ void PlayerMediaEnded(MediaPlayer sender, object args)
}
}
- static string GetSpeakParametersSSMLProsody(string text, SpeakSettings settings)
+ static string GetSpeakParametersSSMLProsody(string text, SpeechOptions options)
{
var volume = "default";
var pitch = "default";
var rate = "default";
// Look for the specified language, otherwise the default voice
- var locale = settings?.Locale?.Language ?? SpeechSynthesizer.DefaultVoice.Language;
+ var locale = options?.Locale?.Language ?? SpeechSynthesizer.DefaultVoice.Language;
- if (settings?.Volume.HasValue ?? false)
- volume = (settings.Volume.Value * 100f).ToString(CultureInfo.InvariantCulture);
+ if (options?.Volume.HasValue ?? false)
+ volume = (options.Volume.Value * 100f).ToString(CultureInfo.InvariantCulture);
- if (settings?.Pitch.HasValue ?? false)
- pitch = ProsodyPitch(settings.Pitch);
+ if (options?.Pitch.HasValue ?? false)
+ pitch = ProsodyPitch(options.Pitch);
// SSML generation
var ssml = new StringBuilder();
diff --git a/Xamarin.Essentials/Types/DeviceIdiom.shared.cs b/Xamarin.Essentials/Types/DeviceIdiom.shared.cs
new file mode 100644
index 000000000..731748a5c
--- /dev/null
+++ b/Xamarin.Essentials/Types/DeviceIdiom.shared.cs
@@ -0,0 +1,56 @@
+using System;
+
+namespace Xamarin.Essentials
+{
+ public readonly struct DeviceIdiom : IEquatable
+ {
+ readonly string deviceIdiom;
+
+ public static DeviceIdiom Phone { get; } = new DeviceIdiom(nameof(Phone));
+
+ public static DeviceIdiom Tablet { get; } = new DeviceIdiom(nameof(Tablet));
+
+ public static DeviceIdiom Desktop { get; } = new DeviceIdiom(nameof(Desktop));
+
+ public static DeviceIdiom TV { get; } = new DeviceIdiom(nameof(TV));
+
+ public static DeviceIdiom Watch { get; } = new DeviceIdiom(nameof(Watch));
+
+ public static DeviceIdiom Unknown { get; } = new DeviceIdiom(nameof(Unknown));
+
+ DeviceIdiom(string deviceIdiom)
+ {
+ if (deviceIdiom == null)
+ throw new ArgumentNullException(nameof(deviceIdiom));
+
+ if (deviceIdiom.Length == 0)
+ throw new ArgumentException(nameof(deviceIdiom));
+
+ this.deviceIdiom = deviceIdiom;
+ }
+
+ public static DeviceIdiom Create(string deviceIdiom) =>
+ new DeviceIdiom(deviceIdiom);
+
+ public bool Equals(DeviceIdiom other) =>
+ Equals(other.deviceIdiom);
+
+ internal bool Equals(string other) =>
+ string.Equals(deviceIdiom, other, StringComparison.Ordinal);
+
+ public override bool Equals(object obj) =>
+ obj is DeviceIdiom && Equals((DeviceIdiom)obj);
+
+ public override int GetHashCode() =>
+ deviceIdiom == null ? 0 : deviceIdiom.GetHashCode();
+
+ public override string ToString() =>
+ deviceIdiom ?? string.Empty;
+
+ public static bool operator ==(DeviceIdiom left, DeviceIdiom right) =>
+ left.Equals(right);
+
+ public static bool operator !=(DeviceIdiom left, DeviceIdiom right) =>
+ !(left == right);
+ }
+}
diff --git a/Xamarin.Essentials/Types/DevicePlatform.shared.cs b/Xamarin.Essentials/Types/DevicePlatform.shared.cs
new file mode 100644
index 000000000..230e2a7fa
--- /dev/null
+++ b/Xamarin.Essentials/Types/DevicePlatform.shared.cs
@@ -0,0 +1,52 @@
+using System;
+
+namespace Xamarin.Essentials
+{
+ public readonly struct DevicePlatform : IEquatable
+ {
+ readonly string devicePlatform;
+
+ public static DevicePlatform Android { get; } = new DevicePlatform(nameof(Android));
+
+ public static DevicePlatform iOS { get; } = new DevicePlatform(nameof(iOS));
+
+ public static DevicePlatform UWP { get; } = new DevicePlatform(nameof(UWP));
+
+ public static DevicePlatform Unknown { get; } = new DevicePlatform(nameof(Unknown));
+
+ DevicePlatform(string devicePlatform)
+ {
+ if (devicePlatform == null)
+ throw new ArgumentNullException(nameof(devicePlatform));
+
+ if (devicePlatform.Length == 0)
+ throw new ArgumentException(nameof(devicePlatform));
+
+ this.devicePlatform = devicePlatform;
+ }
+
+ public static DevicePlatform Create(string devicePlatform) =>
+ new DevicePlatform(devicePlatform);
+
+ public bool Equals(DevicePlatform other) =>
+ Equals(other.devicePlatform);
+
+ internal bool Equals(string other) =>
+ string.Equals(devicePlatform, other, StringComparison.Ordinal);
+
+ public override bool Equals(object obj) =>
+ obj is DevicePlatform && Equals((DevicePlatform)obj);
+
+ public override int GetHashCode() =>
+ devicePlatform == null ? 0 : devicePlatform.GetHashCode();
+
+ public override string ToString() =>
+ devicePlatform ?? string.Empty;
+
+ public static bool operator ==(DevicePlatform left, DevicePlatform right) =>
+ left.Equals(right);
+
+ public static bool operator !=(DevicePlatform left, DevicePlatform right) =>
+ !(left == right);
+ }
+}
diff --git a/Xamarin.Essentials/Types/DisplayInfo.shared.cs b/Xamarin.Essentials/Types/DisplayInfo.shared.cs
new file mode 100644
index 000000000..e482e98c3
--- /dev/null
+++ b/Xamarin.Essentials/Types/DisplayInfo.shared.cs
@@ -0,0 +1,51 @@
+using System;
+
+namespace Xamarin.Essentials
+{
+ [Preserve(AllMembers = true)]
+ public readonly struct DisplayInfo : IEquatable
+ {
+ public DisplayInfo(double width, double height, double density, DisplayOrientation orientation, DisplayRotation rotation)
+ {
+ Width = width;
+ Height = height;
+ Density = density;
+ Orientation = orientation;
+ Rotation = rotation;
+ }
+
+ public double Width { get; }
+
+ public double Height { get; }
+
+ public double Density { get; }
+
+ public DisplayOrientation Orientation { get; }
+
+ public DisplayRotation Rotation { get; }
+
+ public static bool operator ==(DisplayInfo left, DisplayInfo right) =>
+ Equals(left, right);
+
+ public static bool operator !=(DisplayInfo left, DisplayInfo right) =>
+ !Equals(left, right);
+
+ public override bool Equals(object obj) =>
+ (obj is DisplayInfo metrics) && Equals(metrics);
+
+ public bool Equals(DisplayInfo other) =>
+ Width.Equals(other.Width) &&
+ Height.Equals(other.Height) &&
+ Density.Equals(other.Density) &&
+ Orientation.Equals(other.Orientation) &&
+ Rotation.Equals(other.Rotation);
+
+ public override int GetHashCode() =>
+ (Height, Width, Density, Orientation, Rotation).GetHashCode();
+
+ public override string ToString() =>
+ $"{nameof(Height)}: {Height}, {nameof(Width)}: {Width}, " +
+ $"{nameof(Density)}: {Density}, {nameof(Orientation)}: {Orientation}, " +
+ $"{nameof(Rotation)}: {Rotation}";
+ }
+}
diff --git a/Xamarin.Essentials/Types/DisplayOrientation.shared.cs b/Xamarin.Essentials/Types/DisplayOrientation.shared.cs
new file mode 100644
index 000000000..78ca7d6bc
--- /dev/null
+++ b/Xamarin.Essentials/Types/DisplayOrientation.shared.cs
@@ -0,0 +1,9 @@
+namespace Xamarin.Essentials
+{
+ public enum DisplayOrientation
+ {
+ Unknown = 0,
+ Portrait = 1,
+ Landscape = 2
+ }
+}
diff --git a/Xamarin.Essentials/Types/DisplayRotation.shared.cs b/Xamarin.Essentials/Types/DisplayRotation.shared.cs
new file mode 100644
index 000000000..7c9f9c0e2
--- /dev/null
+++ b/Xamarin.Essentials/Types/DisplayRotation.shared.cs
@@ -0,0 +1,11 @@
+namespace Xamarin.Essentials
+{
+ public enum DisplayRotation
+ {
+ Unknown = 0,
+ Rotation0 = 1,
+ Rotation90 = 2,
+ Rotation180 = 3,
+ Rotation270 = 4
+ }
+}
diff --git a/Xamarin.Essentials/Types/Location.shared.cs b/Xamarin.Essentials/Types/Location.shared.cs
index 4675e5cfb..442abfab9 100644
--- a/Xamarin.Essentials/Types/Location.shared.cs
+++ b/Xamarin.Essentials/Types/Location.shared.cs
@@ -57,46 +57,32 @@ public Location(Location point)
public double? Course { get; set; }
public static double CalculateDistance(double latitudeStart, double longitudeStart, Location locationEnd, DistanceUnits units) =>
- CalculateDistance(latitudeStart, locationEnd.Latitude, longitudeStart, locationEnd.Longitude, units);
+ CalculateDistance(latitudeStart, longitudeStart, locationEnd.Latitude, locationEnd.Longitude, units);
public static double CalculateDistance(Location locationStart, double latitudeEnd, double longitudeEnd, DistanceUnits units) =>
- CalculateDistance(locationStart.Latitude, latitudeEnd, locationStart.Longitude, longitudeEnd, units);
+ CalculateDistance(locationStart.Latitude, locationStart.Longitude, latitudeEnd, longitudeEnd, units);
public static double CalculateDistance(Location locationStart, Location locationEnd, DistanceUnits units) =>
- CalculateDistance(locationStart.Latitude, locationEnd.Latitude, locationStart.Longitude, locationEnd.Longitude, units);
+ CalculateDistance(locationStart.Latitude, locationStart.Longitude, locationEnd.Latitude, locationEnd.Longitude, units);
public static double CalculateDistance(
double latitudeStart,
- double latitudeEnd,
double longitudeStart,
+ double latitudeEnd,
double longitudeEnd,
DistanceUnits units)
{
- if (latitudeEnd == latitudeStart && longitudeEnd == longitudeStart)
- return 0;
-
- var rlat1 = PI * latitudeStart / 180.0;
- var rlat2 = PI * latitudeEnd / 180.0;
- var theta = longitudeStart - longitudeEnd;
- var rtheta = PI * theta / 180.0;
- var dist = (Sin(rlat1) * Sin(rlat2)) + (Cos(rlat1) * Cos(rlat2) * Cos(rtheta));
- dist = Acos(dist);
- dist = dist * 180.0 / PI;
- var final = dist * 60.0 * 1.1515;
- if (double.IsNaN(final) || double.IsInfinity(final) || double.IsNegativeInfinity(final) ||
- double.IsPositiveInfinity(final) || final < 0)
- return 0;
-
- if (units == DistanceUnits.Kilometers)
- return MilesToKilometers(final);
-
- return final;
+ switch (units)
+ {
+ case DistanceUnits.Kilometers:
+ return UnitConverters.CoordinatesToKilometers(latitudeStart, longitudeStart, latitudeEnd, longitudeEnd);
+ case DistanceUnits.Miles:
+ return UnitConverters.CoordinatesToMiles(latitudeStart, longitudeStart, latitudeEnd, longitudeEnd);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(units));
+ }
}
- public static double MilesToKilometers(double miles) => miles * 1.609344;
-
- public static double KilometersToMiles(double kilometers) => kilometers * .62137119;
-
public override string ToString() =>
$"{nameof(Latitude)}: {Latitude}, {nameof(Longitude)}: {Longitude}, " +
$"{nameof(Altitude)}: {Altitude ?? 0}, {nameof(Accuracy)}: {Accuracy ?? 0}, " +
diff --git a/Xamarin.Essentials/Types/LocationExtensions.shared.cs b/Xamarin.Essentials/Types/LocationExtensions.shared.cs
index 00336ea75..2b7f415e2 100644
--- a/Xamarin.Essentials/Types/LocationExtensions.shared.cs
+++ b/Xamarin.Essentials/Types/LocationExtensions.shared.cs
@@ -10,10 +10,10 @@ public static double CalculateDistance(this Location locationStart, double latit
public static double CalculateDistance(this Location locationStart, Location locationEnd, DistanceUnits units) =>
Location.CalculateDistance(locationStart, locationEnd, units);
- public static Task OpenMapsAsync(this Location location, MapsLaunchOptions options) =>
- Maps.OpenAsync(location, options);
+ public static Task OpenMapsAsync(this Location location, MapLaunchOptions options) =>
+ Map.OpenAsync(location, options);
public static Task OpenMapsAsync(this Location location) =>
- Maps.OpenAsync(location);
+ Map.OpenAsync(location);
}
}
diff --git a/Xamarin.Essentials/Types/PlacemarkExtensions.shared.cs b/Xamarin.Essentials/Types/PlacemarkExtensions.shared.cs
index 421e06550..52f4b9cfa 100644
--- a/Xamarin.Essentials/Types/PlacemarkExtensions.shared.cs
+++ b/Xamarin.Essentials/Types/PlacemarkExtensions.shared.cs
@@ -5,11 +5,11 @@ namespace Xamarin.Essentials
{
public static partial class PlacemarkExtensions
{
- public static Task OpenMapsAsync(this Placemark placemark, MapsLaunchOptions options) =>
- Maps.OpenAsync(placemark, options);
+ public static Task OpenMapsAsync(this Placemark placemark, MapLaunchOptions options) =>
+ Map.OpenAsync(placemark, options);
public static Task OpenMapsAsync(this Placemark placemark) =>
- Maps.OpenAsync(placemark);
+ Map.OpenAsync(placemark);
internal static Placemark Escape(this Placemark placemark)
{
diff --git a/Xamarin.Essentials/Types/SensorSpeed.shared.cs b/Xamarin.Essentials/Types/SensorSpeed.shared.cs
index 7ad50ef2f..211769873 100644
--- a/Xamarin.Essentials/Types/SensorSpeed.shared.cs
+++ b/Xamarin.Essentials/Types/SensorSpeed.shared.cs
@@ -2,9 +2,9 @@
{
public enum SensorSpeed
{
- Fastest,
- Game,
- UI,
- Normal,
+ Default = 0,
+ UI = 1,
+ Game = 2,
+ Fastest = 3,
}
}
diff --git a/Xamarin.Essentials/Types/UnitConverters.shared.cs b/Xamarin.Essentials/Types/UnitConverters.shared.cs
new file mode 100644
index 000000000..f789434c1
--- /dev/null
+++ b/Xamarin.Essentials/Types/UnitConverters.shared.cs
@@ -0,0 +1,104 @@
+using System;
+
+namespace Xamarin.Essentials
+{
+ public static class UnitConverters
+ {
+ const double twoPi = 2.0 * Math.PI;
+ const double totalDegrees = 360.0;
+ const double atmospherePascals = 101325.0;
+ const double degreesToRadians = Math.PI / 180.0;
+ const double milesToKilometers = 1.609344;
+ const double milesToMeters = 1609.344;
+ const double kilometersToMiles = 1.0 / milesToKilometers;
+ const double celsiusToKelvin = 273.15;
+
+ const double meanEarthRadiusInKilometers = 6371.0;
+
+ public static double FahrenheitToCelsius(double fahrenheit) =>
+ (fahrenheit - 32.0) / 1.8;
+
+ public static double CelsiusToFahrenheit(double celsius) =>
+ (celsius * 1.8) + 32.0;
+
+ public static double CelsiusToKelvin(double celsius) =>
+ celsius + celsiusToKelvin;
+
+ public static double KelvinToCelsius(double kelvin) =>
+ kelvin - celsiusToKelvin;
+
+ public static double MilesToMeters(double miles) =>
+ miles * milesToMeters;
+
+ public static double MilesToKilometers(double miles) =>
+ miles * milesToKilometers;
+
+ public static double KilometersToMiles(double kilometers) =>
+ kilometers * kilometersToMiles;
+
+ public static double DegreesToRadians(double degrees) =>
+ degrees * degreesToRadians;
+
+ public static double RadiansToDegrees(double radians) =>
+ radians / degreesToRadians;
+
+ public static double DegreesPerSecondToRadiansPerSecond(double degrees) =>
+ HertzToRadiansPerSecond(DegreesPerSecondToHertz(degrees));
+
+ public static double RadiansPerSecondToDegreesPerSecond(double radians) =>
+ HertzToDegreesPerSecond(RadiansPerSecondToHertz(radians));
+
+ public static double DegreesPerSecondToHertz(double degrees) =>
+ degrees / totalDegrees;
+
+ public static double RadiansPerSecondToHertz(double radians) =>
+ radians / twoPi;
+
+ public static double HertzToDegreesPerSecond(double hertz) =>
+ hertz * totalDegrees;
+
+ public static double HertzToRadiansPerSecond(double hertz) =>
+ hertz * twoPi;
+
+ public static double KilopascalsToHectopascals(double kpa) =>
+ kpa * 10.0;
+
+ public static double HectopascalsToKilopascals(double hpa) =>
+ hpa / 10.0;
+
+ public static double KilopascalsToPascals(double kpa) =>
+ kpa * 1000.0;
+
+ public static double HectopascalsToPascals(double hpa) =>
+ hpa * 100.0;
+
+ public static double AtmospheresToPascals(double atm) =>
+ atm / atmospherePascals;
+
+ public static double PascalsToAtmospheres(double pascals) =>
+ pascals * atmospherePascals;
+
+ public static double CoordinatesToMiles(double lat1, double lon1, double lat2, double lon2) =>
+ KilometersToMiles(CoordinatesToKilometers(lat1, lon1, lat2, lon2));
+
+ public static double CoordinatesToKilometers(double lat1, double lon1, double lat2, double lon2)
+ {
+ if (lat1 == lat2 && lon1 == lon2)
+ return 0;
+
+ var dLat = DegreesToRadians(lat2 - lat1);
+ var dLon = DegreesToRadians(lon2 - lon1);
+
+ lat1 = DegreesToRadians(lat1);
+ lat2 = DegreesToRadians(lat2);
+
+ var dLat2 = Math.Sin(dLat / 2) * Math.Sin(dLat / 2);
+ var dLon2 = Math.Sin(dLon / 2) * Math.Sin(dLon / 2);
+
+ var a = dLat2 + (dLon2 * Math.Cos(lat1) * Math.Cos(lat2));
+ var c = 2 * Math.Asin(Math.Sqrt(a));
+
+ return meanEarthRadiusInKilometers * c;
+ }
+ }
+}
diff --git a/Xamarin.Essentials/Xamarin.Essentials.csproj b/Xamarin.Essentials/Xamarin.Essentials.csproj
index bf7f8741f..6afcea55d 100644
--- a/Xamarin.Essentials/Xamarin.Essentials.csproj
+++ b/Xamarin.Essentials/Xamarin.Essentials.csproj
@@ -50,12 +50,12 @@
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
-
+
-
+
diff --git a/docs/.gitattributes b/docs/.gitattributes
new file mode 100644
index 000000000..98798e4a6
--- /dev/null
+++ b/docs/.gitattributes
@@ -0,0 +1,2 @@
+# a special case for docs
+*.xml text eol=lf
\ No newline at end of file
diff --git a/docs/en/FrameworksIndex/xamarin-essentials-android.xml b/docs/en/FrameworksIndex/xamarin-essentials-android.xml
index c10edad15..8023610dd 100644
--- a/docs/en/FrameworksIndex/xamarin-essentials-android.xml
+++ b/docs/en/FrameworksIndex/xamarin-essentials-android.xml
@@ -1,4 +1,7 @@
+
+
+
@@ -7,9 +10,12 @@
+
+
+
@@ -19,7 +25,7 @@
-
+
@@ -33,28 +39,33 @@
+
+
-
+
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
@@ -83,20 +94,22 @@
-
+
+
-
+
+
@@ -109,28 +122,39 @@
-
+
-
+
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -142,23 +166,53 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -188,6 +242,8 @@
+
+
@@ -213,7 +269,6 @@
-
@@ -223,6 +278,7 @@
+
@@ -243,9 +299,12 @@
+
+
+
@@ -275,8 +334,6 @@
-
-
@@ -290,7 +347,7 @@
-
+
@@ -299,9 +356,12 @@
+
+
+
@@ -314,26 +374,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -352,9 +412,12 @@
+
+
+
@@ -387,17 +450,13 @@
-
+
-
-
-
-
@@ -434,39 +493,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -474,11 +500,16 @@
+
-
+
+
+
+
+
@@ -498,16 +529,41 @@
-
-
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/en/FrameworksIndex/xamarin-essentials-ios.xml b/docs/en/FrameworksIndex/xamarin-essentials-ios.xml
index 0c6ff4aee..dd2e87a16 100644
--- a/docs/en/FrameworksIndex/xamarin-essentials-ios.xml
+++ b/docs/en/FrameworksIndex/xamarin-essentials-ios.xml
@@ -1,4 +1,7 @@
+
+
+
@@ -7,9 +10,12 @@
+
+
+
@@ -19,7 +25,7 @@
-
+
@@ -33,28 +39,33 @@
+
+
-
+
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
@@ -83,21 +94,23 @@
-
+
+
-
+
+
@@ -110,28 +123,39 @@
-
+
-
+
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -143,23 +167,53 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -189,6 +243,8 @@
+
+
@@ -214,7 +270,6 @@
-
@@ -224,6 +279,7 @@
+
@@ -244,9 +300,12 @@
+
+
+
@@ -276,8 +335,6 @@
-
-
@@ -291,7 +348,7 @@
-
+
@@ -300,9 +357,12 @@
+
+
+
@@ -315,26 +375,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -353,9 +413,12 @@
+
+
+
@@ -388,13 +451,9 @@
-
+
-
-
-
-
@@ -431,39 +490,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -473,11 +499,16 @@
+
-
+
+
+
+
+
@@ -497,16 +528,41 @@
-
-
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml b/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml
index bbdc5414e..79c61cf9c 100644
--- a/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml
+++ b/docs/en/FrameworksIndex/xamarin-essentials-uwp.xml
@@ -1,4 +1,7 @@
+
+
+
@@ -7,9 +10,12 @@
+
+
+
@@ -19,7 +25,7 @@
-
+
@@ -33,28 +39,33 @@
+
+
-
+
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
@@ -83,20 +94,22 @@
-
+
+
-
+
+
@@ -109,28 +122,39 @@
-
+
-
+
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -142,23 +166,53 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -188,6 +242,8 @@
+
+
@@ -213,7 +269,6 @@
-
@@ -223,6 +278,7 @@
+
@@ -243,9 +299,12 @@
+
+
+
@@ -275,8 +334,6 @@
-
-
@@ -290,7 +347,7 @@
-
+
@@ -299,9 +356,12 @@
+
+
+
@@ -314,26 +374,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -352,9 +412,12 @@
+
+
+
@@ -387,12 +450,10 @@
-
+
-
-
-
-
+
+
@@ -430,39 +491,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -470,11 +498,16 @@
+
-
+
+
+
+
+
@@ -494,16 +527,41 @@
-
-
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/en/FrameworksIndex/xamarin-essentials.xml b/docs/en/FrameworksIndex/xamarin-essentials.xml
index dd095f9c8..a0c40a186 100644
--- a/docs/en/FrameworksIndex/xamarin-essentials.xml
+++ b/docs/en/FrameworksIndex/xamarin-essentials.xml
@@ -1,4 +1,7 @@
+
+
+
@@ -7,9 +10,12 @@
+
+
+
@@ -19,7 +25,7 @@
-
+
@@ -33,28 +39,33 @@
+
+
-
+
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
@@ -83,20 +94,22 @@
-
+
+
-
+
+
@@ -109,28 +122,39 @@
-
+
-
+
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -142,23 +166,53 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -188,6 +242,8 @@
+
+
@@ -213,7 +269,6 @@
-
@@ -223,6 +278,7 @@
+
@@ -243,9 +299,12 @@
+
+
+
@@ -275,8 +334,6 @@
-
-
@@ -290,7 +347,7 @@
-
+
@@ -299,9 +356,12 @@
+
+
+
@@ -314,26 +374,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -352,9 +412,12 @@
+
+
+
@@ -387,12 +450,7 @@
-
-
-
-
-
-
+
@@ -430,39 +488,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -470,11 +495,16 @@
+
-
+
+
+
+
+
@@ -494,16 +524,41 @@
-
-
-
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/en/Xamarin.Essentials/Accelerometer.xml b/docs/en/Xamarin.Essentials/Accelerometer.xml
index 48949cfb3..5ef1eaac7 100644
--- a/docs/en/Xamarin.Essentials/Accelerometer.xml
+++ b/docs/en/Xamarin.Essentials/Accelerometer.xml
@@ -14,9 +14,7 @@
Accelerometer data of the acceleration of the device in three dimensional space.
-
-
-
+
@@ -34,9 +32,7 @@
Gets if acceleromter is being monitored.
If monitoring.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/AccelerometerChangedEventArgs.xml b/docs/en/Xamarin.Essentials/AccelerometerChangedEventArgs.xml
index 0e0c17320..edd5c78dc 100644
--- a/docs/en/Xamarin.Essentials/AccelerometerChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/AccelerometerChangedEventArgs.xml
@@ -15,6 +15,24 @@
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/AccelerometerData.xml b/docs/en/Xamarin.Essentials/AccelerometerData.xml
index 7ccf5b1ab..ef6b59b01 100644
--- a/docs/en/Xamarin.Essentials/AccelerometerData.xml
+++ b/docs/en/Xamarin.Essentials/AccelerometerData.xml
@@ -21,11 +21,53 @@
Data representing the devies' three accelerometers.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/AppInfo.xml b/docs/en/Xamarin.Essentials/AppInfo.xml
index bf61d722f..a51c02f10 100644
--- a/docs/en/Xamarin.Essentials/AppInfo.xml
+++ b/docs/en/Xamarin.Essentials/AppInfo.xml
@@ -53,26 +53,6 @@
-
-
-
-
- Method
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.Void
-
-
-
- Open the settings menu or page for the application.
-
-
-
-
-
@@ -91,6 +71,26 @@
On android and iOS, this is the application package name. On UWP, this is the application GUID.
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Void
+
+
+
+ Open the settings menu or page for the application.
+
+
+
+
+
diff --git a/docs/en/Xamarin.Essentials/Barometer.xml b/docs/en/Xamarin.Essentials/Barometer.xml
index 434a7fed6..968231480 100644
--- a/docs/en/Xamarin.Essentials/Barometer.xml
+++ b/docs/en/Xamarin.Essentials/Barometer.xml
@@ -12,9 +12,7 @@
Monitor changes to the atmospheric pressure.
-
-
-
+
@@ -32,9 +30,7 @@
Gets if barometer is actively being monitored.
If barometer is being monitored.
-
-
-
+
@@ -51,9 +47,7 @@
Event triggered when barometer reading changes.
-
-
-
+
@@ -92,9 +86,7 @@
Stop monitoring for changes to the barometer.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/BarometerChangedEventArgs.xml b/docs/en/Xamarin.Essentials/BarometerChangedEventArgs.xml
index 21ac63d12..2b013f47b 100644
--- a/docs/en/Xamarin.Essentials/BarometerChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/BarometerChangedEventArgs.xml
@@ -12,11 +12,27 @@
The current pressure information from the change event.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
@@ -32,9 +48,7 @@
Gets the current barometer pressure data
Pressure in hPA
-
-
-
+
@@ -52,9 +66,7 @@
Get the current reading of the barometer
The reading
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/BarometerData.xml b/docs/en/Xamarin.Essentials/BarometerData.xml
index 688055145..8fba5a779 100644
--- a/docs/en/Xamarin.Essentials/BarometerData.xml
+++ b/docs/en/Xamarin.Essentials/BarometerData.xml
@@ -23,11 +23,27 @@
Contains the pressure measured by the user's device.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
@@ -74,9 +90,7 @@
Other object to compare
If equal to another object
If equal
-
-
-
+
@@ -95,9 +109,7 @@
Get has code for object.
The hash code.
-
-
-
+
@@ -147,15 +159,13 @@
Right to comapre
If not equal to another object
If not equal
-
-
-
+
-
-
-
-
+
+
+
+
Property
Xamarin.Essentials
@@ -165,11 +175,9 @@
System.Double
- Pressure in hPA
- The pressure
-
-
-
+ To be added.
+ To be added.
+ To be added.
diff --git a/docs/en/Xamarin.Essentials/Battery.xml b/docs/en/Xamarin.Essentials/Battery.xml
index 404c1521e..06185f8bc 100644
--- a/docs/en/Xamarin.Essentials/Battery.xml
+++ b/docs/en/Xamarin.Essentials/Battery.xml
@@ -17,27 +17,24 @@
- Android: Battery_Stats permission must be set in manifest.
- iOS: Simulator will not return battery information, must be run on device
- UWP: None
-
-
-
-
-
+
+
+
+
Event
1.0.0.0
Xamarin.Essentials
- System.EventHandler<Xamarin.Essentials.BatteryChangedEventArgs>
+ System.EventHandler<Xamarin.Essentials.BatteryInfoChangedEventArgs>
Event trigger when battery properties have changed.
-
-
-
+
@@ -57,9 +54,42 @@
Level of charge.
-
-
-
+
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.EnergySaverStatus
+
+
+ Gets the current energy saver status of the device.
+ The current status of energy saver mode.
+
+
+
+
+
+
+
+ Event
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.EventHandler<Xamarin.Essentials.EnergySaverStatusChangedEventArgs>
+
+
+ Event that is triggered when energy saver status changes.
+
@@ -79,9 +109,7 @@
Power source, or uknown.
-
-
-
+
@@ -99,9 +127,7 @@
Gets the charging state of the device if it can be determined.
Battery state, or unknown.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/BatteryChangedEventArgs.xml b/docs/en/Xamarin.Essentials/BatteryInfoChangedEventArgs.xml
similarity index 65%
rename from docs/en/Xamarin.Essentials/BatteryChangedEventArgs.xml
rename to docs/en/Xamarin.Essentials/BatteryInfoChangedEventArgs.xml
index 3daa85de1..ca3b5bf91 100644
--- a/docs/en/Xamarin.Essentials/BatteryChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/BatteryInfoChangedEventArgs.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -15,10 +15,32 @@
Returns the current information of the battery.
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
-
+
Property
1.0.0.0
@@ -30,15 +52,13 @@
Gets the current charge level of the device from 0.0 to 1.0.
Level of charge.
-
-
-
+
-
+
Property
1.0.0.0
@@ -50,15 +70,13 @@
Gets the current power source for the device.
Power source, or unknown
-
-
-
+
-
+
Property
1.0.0.0
@@ -70,15 +88,13 @@
Gets the charging state of the device if it can be determined.
Battery state, or unknown.
-
-
-
+
-
+
Method
Xamarin.Essentials
diff --git a/docs/en/Xamarin.Essentials/BatteryPowerSource.xml b/docs/en/Xamarin.Essentials/BatteryPowerSource.xml
index cdfd85696..baf00644d 100644
--- a/docs/en/Xamarin.Essentials/BatteryPowerSource.xml
+++ b/docs/en/Xamarin.Essentials/BatteryPowerSource.xml
@@ -11,9 +11,7 @@
How the device and battery are currently being powered or charged.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/BatteryState.xml b/docs/en/Xamarin.Essentials/BatteryState.xml
index e4a568d49..d2b619fd9 100644
--- a/docs/en/Xamarin.Essentials/BatteryState.xml
+++ b/docs/en/Xamarin.Essentials/BatteryState.xml
@@ -11,9 +11,7 @@
The current state of the battery and if it is being charged or full.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/Browser.xml b/docs/en/Xamarin.Essentials/Browser.xml
index df10fd993..b07b13b90 100644
--- a/docs/en/Xamarin.Essentials/Browser.xml
+++ b/docs/en/Xamarin.Essentials/Browser.xml
@@ -21,8 +21,8 @@
Method
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
System.Threading.Tasks.Task
@@ -33,10 +33,8 @@
Uri to launch.
Open the browser to specified uri.
- Completed task when browser is launched.
-
-
-
+ Completed task when browser is launched, but not necessarily closed. Result indicates if launching was successful or not.
+
@@ -45,8 +43,8 @@
Method
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
System.Threading.Tasks.Task
@@ -57,10 +55,8 @@
Uri to launch.
Open the browser to specified uri.
- Completed task when browser is launched.
-
-
-
+ Completed task when browser is launched, but not necessarily closed. Result indicates if launching was successful or not.
+
@@ -69,37 +65,35 @@
Method
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
System.Threading.Tasks.Task
-
-
+
+
Uri to launch.
How to launch the browser.
Open the browser to specified uri.
- Completed task when browser is launched.
-
-
-
+ Completed task when browser is launched, but not necessarily closed. Result indicates if launching was successful or not.
+
-
-
+
+
Method
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- System.Threading.Tasks.Task
+ System.Threading.Tasks.Task<System.Boolean>
@@ -109,10 +103,8 @@
Uri to launch.
How to launch the browser.
Open the browser to specified uri.
- Completed task when browser is launched.
-
-
-
+ Completed task when browser is launched, but not necessarily closed. Result indicates if launching was successful or not.
+
diff --git a/docs/en/Xamarin.Essentials/BrowserLaunchMode.xml b/docs/en/Xamarin.Essentials/BrowserLaunchMode.xml
index ede90445b..301814870 100644
--- a/docs/en/Xamarin.Essentials/BrowserLaunchMode.xml
+++ b/docs/en/Xamarin.Essentials/BrowserLaunchMode.xml
@@ -16,7 +16,7 @@
-
+
Field
@@ -26,14 +26,14 @@
Xamarin.Essentials.BrowserLaunchMode
- 0
+ 1
Use the default external launcher to open the browser outside of the app.
-
+
Field
@@ -43,7 +43,7 @@
Xamarin.Essentials.BrowserLaunchMode
- 1
+ 0
Launch the optimized system browser and stay inside of your application. (Chrome Custom Tabs and SFSafariViewController).
diff --git a/docs/en/Xamarin.Essentials/Clipboard.xml b/docs/en/Xamarin.Essentials/Clipboard.xml
index 11a0719ad..5ae388daf 100644
--- a/docs/en/Xamarin.Essentials/Clipboard.xml
+++ b/docs/en/Xamarin.Essentials/Clipboard.xml
@@ -12,9 +12,7 @@
Provides a way to work with text on the device clipboard.
-
-
-
+
@@ -60,17 +58,17 @@
-
-
-
-
+
+
+
+
Method
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- System.Void
+ System.Threading.Tasks.Task
@@ -78,6 +76,7 @@
The text to put on the clipboard.
Sets the contents of the clipboard to be the specified text.
+ Returns text that is on the clipboard, or null if there is none.
This method returns immediately and does not guarentee that the text is on the clipboard by the time this method returns
diff --git a/docs/en/Xamarin.Essentials/Compass.xml b/docs/en/Xamarin.Essentials/Compass.xml
index 8cf049a52..60f9fcbde 100644
--- a/docs/en/Xamarin.Essentials/Compass.xml
+++ b/docs/en/Xamarin.Essentials/Compass.xml
@@ -13,30 +13,10 @@
Monitor changes to the orientation of the user's device.
-
+
-
-
-
-
- Property
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.Boolean
-
-
- Applies a moving average filter on the Android implementation. Unused on other platforms
- If a low pass filter is applied
-
-
-
-
-
@@ -52,9 +32,7 @@
Gets if compass is actively being monitored.
If compass is being monitored.
-
-
-
+
@@ -115,6 +93,29 @@
Will throw FeatureNotSupportedException if not supported on device. Will throw ArgumentNullException if handler is null.
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Void
+
+
+
+
+
+
+ The speed to monitor for changes.
+ Whether or not to apply a moving average filter (only used on Android).
+ Start monitoring for changes to the compass.
+ Will throw FeatureNotSupportedException if not supported on device. Will throw ArgumentNullException if handler is null.
+
+
@@ -130,9 +131,7 @@
Stop monitoring for changes to the compass.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/CompassChangedEventArgs.xml b/docs/en/Xamarin.Essentials/CompassChangedEventArgs.xml
index b09aad163..529a4e42f 100644
--- a/docs/en/Xamarin.Essentials/CompassChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/CompassChangedEventArgs.xml
@@ -17,6 +17,24 @@
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/CompassData.xml b/docs/en/Xamarin.Essentials/CompassData.xml
index 015b42869..8b4ac0989 100644
--- a/docs/en/Xamarin.Essentials/CompassData.xml
+++ b/docs/en/Xamarin.Essentials/CompassData.xml
@@ -23,11 +23,27 @@
Contains the orientation of the user's device.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/ConnectionProfile.xml b/docs/en/Xamarin.Essentials/ConnectionProfile.xml
index d3fd35b09..f9ca29a6a 100644
--- a/docs/en/Xamarin.Essentials/ConnectionProfile.xml
+++ b/docs/en/Xamarin.Essentials/ConnectionProfile.xml
@@ -11,14 +11,12 @@
Describes the type of connection the device is using.
-
-
-
+
-
+
Field
@@ -28,14 +26,14 @@
Xamarin.Essentials.ConnectionProfile
- 0
+ 1
The bluetooth data connection.
-
+
Field
@@ -45,14 +43,14 @@
Xamarin.Essentials.ConnectionProfile
- 1
+ 2
The mobile/cellular data connection.
-
+
Field
@@ -62,15 +60,15 @@
Xamarin.Essentials.ConnectionProfile
- 2
+ 3
The ethernet data connection.
-
-
-
-
+
+
+
+
Field
1.0.0.0
@@ -79,9 +77,9 @@
Xamarin.Essentials.ConnectionProfile
- 5
+ 0
- Other non-known type of connection.
+ Other unknown type of connection.
@@ -101,22 +99,5 @@
The WiFi data connection.
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- Xamarin.Essentials.ConnectionProfile
-
- 3
-
- The WiMAX data connection.
-
-
diff --git a/docs/en/Xamarin.Essentials/Connectivity.xml b/docs/en/Xamarin.Essentials/Connectivity.xml
index f562a0f2d..6e267c0fe 100644
--- a/docs/en/Xamarin.Essentials/Connectivity.xml
+++ b/docs/en/Xamarin.Essentials/Connectivity.xml
@@ -12,11 +12,29 @@
Connectivity and networking helpers.
-
-
-
+
+
+
+
+
+ Property
+
+ 1.0.0.0
+ Xamarin.Essentials
+
+
+ System.Collections.Generic.IEnumerable<Xamarin.Essentials.ConnectionProfile>
+
+
+ Gets the active connectivity types for the device.
+ List of all connection profiles.
+
+ Can throw PermissionException on Android if ACCESS_NETWORK_STATE is not set in manifest.
+
+
+
@@ -35,7 +53,6 @@
Can throw PermissionException on Android if ACCESS_NETWORK_STATE is not set in manifest.
-
@@ -59,25 +76,5 @@
-
-
-
-
- Property
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.Collections.Generic.IEnumerable<Xamarin.Essentials.ConnectionProfile>
-
-
- Gets the active connectivity types for the device.
- List of all connection profiles.
-
- Can throw PermissionException on Android if ACCESS_NETWORK_STATE is not set in manifest.
-
-
-
diff --git a/docs/en/Xamarin.Essentials/ConnectivityChangedEventArgs.xml b/docs/en/Xamarin.Essentials/ConnectivityChangedEventArgs.xml
index 3c28a0055..6be16e934 100644
--- a/docs/en/Xamarin.Essentials/ConnectivityChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/ConnectivityChangedEventArgs.xml
@@ -17,30 +17,30 @@
-
-
-
-
- Property
+
+
+
+
+ Constructor
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
-
- Xamarin.Essentials.NetworkAccess
-
+
+
+
+
- Gets the current state of network access. Does not guarantee full access to the internet.
- The current network access state.
-
-
-
+ To be added.
+ To be added.
+ To be added.
+ To be added.
-
-
-
-
+
+
+
+
Property
1.0.0.0
@@ -57,6 +57,24 @@
+
+
+
+
+ Property
+
+ 1.0.0.0
+ Xamarin.Essentials
+
+
+ Xamarin.Essentials.NetworkAccess
+
+
+ Gets the current state of network access. Does not guarantee full access to the internet.
+ The current network access state.
+
+
+
diff --git a/docs/en/Xamarin.Essentials/DeviceDisplay.xml b/docs/en/Xamarin.Essentials/DeviceDisplay.xml
index 525a9c461..c06ec8d20 100644
--- a/docs/en/Xamarin.Essentials/DeviceDisplay.xml
+++ b/docs/en/Xamarin.Essentials/DeviceDisplay.xml
@@ -13,45 +13,67 @@
Represents information about the device screen.
-
+
-
-
-
-
+
+
+
+
Property
+ Xamarin.Essentials
1.0.0.0
+
+
+ System.Boolean
+
+
+ Gets or sets if the screen shold be kept on.
+ If the screen keep on is set.
+
+
+
+
+
+
+
+
+
+ Property
+
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenMetrics
+ Xamarin.Essentials.DisplayInfo
- Gets the screen metrics of the device.
- The screen metrics.
+ Gets the main screens display info.
+ The main screen display info.
-
-
-
-
+
+
+
+
Event
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- System.EventHandler<Xamarin.Essentials.ScreenMetricsChangedEventArgs>
+ System.EventHandler<Xamarin.Essentials.DisplayInfoChangedEventArgs>
- Event that is triggered when the screen matrics change.
- Such as screen rotation.
+ Event that is triggered when the main display info changes.
+
+
+
diff --git a/docs/en/Xamarin.Essentials/DeviceIdiom.xml b/docs/en/Xamarin.Essentials/DeviceIdiom.xml
new file mode 100644
index 000000000..50e9113dc
--- /dev/null
+++ b/docs/en/Xamarin.Essentials/DeviceIdiom.xml
@@ -0,0 +1,293 @@
+
+
+
+
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.ValueType
+
+
+
+ System.IEquatable<Xamarin.Essentials.DeviceIdiom>
+
+
+
+
+ System.Runtime.CompilerServices.IsReadOnly
+
+
+
+ The idiom (form factor) of the device.
+
+
+
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DeviceIdiom
+
+
+
+
+
+ To be added.
+ Creates a new device idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DeviceIdiom
+
+
+ Gets the desktop idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ To be added.
+ Checks the equality of the idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ M:System.IEquatable`1.Equals(`0)
+
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ To be added.
+ Checks the equality of the idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Int32
+
+
+
+ Gets the hash code for the idom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+
+ To be added.
+ To be added.
+ Checks the equality of the idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+
+ To be added.
+ To be added.
+ Checks the equality of the idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DeviceIdiom
+
+
+ Gets the phone idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DeviceIdiom
+
+
+ Gets the tablet idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.String
+
+
+
+ String representation of the idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DeviceIdiom
+
+
+ Gets the TV idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DeviceIdiom
+
+
+ Gets the unknown idiom.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DeviceIdiom
+
+
+ Gets the watch idiom.
+ To be added.
+ To be added.
+
+
+
+
diff --git a/docs/en/Xamarin.Essentials/DeviceInfo+Idioms.xml b/docs/en/Xamarin.Essentials/DeviceInfo+Idioms.xml
deleted file mode 100644
index 40462a611..000000000
--- a/docs/en/Xamarin.Essentials/DeviceInfo+Idioms.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.Object
-
-
-
- The device idiom.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- A desktop device such as laptop or tower.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- A mobile phone.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- A tablet.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- A television.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- Unsupported or unknown device.
-
-
-
-
-
-
-
diff --git a/docs/en/Xamarin.Essentials/DeviceInfo+Platforms.xml b/docs/en/Xamarin.Essentials/DeviceInfo+Platforms.xml
deleted file mode 100644
index e30398f5e..000000000
--- a/docs/en/Xamarin.Essentials/DeviceInfo+Platforms.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.Object
-
-
-
- Platform operating system of the device.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- The Android operating system.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- The iOS operating system.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- An unknown or unsupported operating system.
-
-
-
-
-
-
-
-
-
- Field
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- Universal Windows Platform.
-
-
-
-
-
-
-
diff --git a/docs/en/Xamarin.Essentials/DeviceInfo.xml b/docs/en/Xamarin.Essentials/DeviceInfo.xml
index 4163a7cf9..8ff77191f 100644
--- a/docs/en/Xamarin.Essentials/DeviceInfo.xml
+++ b/docs/en/Xamarin.Essentials/DeviceInfo.xml
@@ -13,7 +13,7 @@
Represents information about the device.
-
+
@@ -38,8 +38,8 @@
-
-
+
+
Property
@@ -47,7 +47,7 @@
Xamarin.Essentials
- System.String
+ Xamarin.Essentials.DeviceIdiom
Gets the idiom of the device.
@@ -118,8 +118,8 @@
-
-
+
+
Property
@@ -127,7 +127,7 @@
Xamarin.Essentials
- System.String
+ Xamarin.Essentials.DevicePlatform
Gets the platform or operating system of the device.
diff --git a/docs/en/Xamarin.Essentials/DevicePlatform.xml b/docs/en/Xamarin.Essentials/DevicePlatform.xml
new file mode 100644
index 000000000..56431e8f5
--- /dev/null
+++ b/docs/en/Xamarin.Essentials/DevicePlatform.xml
@@ -0,0 +1,257 @@
+
+
+
+
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.ValueType
+
+
+
+ System.IEquatable<Xamarin.Essentials.DevicePlatform>
+
+
+
+
+ System.Runtime.CompilerServices.IsReadOnly
+
+
+
+ The device platform that the application is running on.
+
+
+
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DevicePlatform
+
+
+ Gets the Android platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DevicePlatform
+
+
+
+
+
+ To be added.
+ Creates a new Device Platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ To be added.
+ Checks the equality of the platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ M:System.IEquatable`1.Equals(`0)
+
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+ To be added.
+ Checks the equality of the platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Int32
+
+
+
+ Gets the hash code of the platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DevicePlatform
+
+
+ Gets the iOS platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+
+ To be added.
+ To be added.
+ Checks the equality of the platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Boolean
+
+
+
+
+
+
+ To be added.
+ To be added.
+ Checks the equality of the platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.String
+
+
+
+ The string representation of the platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DevicePlatform
+
+
+ Gets the unknown platform.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DevicePlatform
+
+
+ Gets the UWP platform.
+ To be added.
+ To be added.
+
+
+
+
diff --git a/docs/en/Xamarin.Essentials/ScreenMetrics.xml b/docs/en/Xamarin.Essentials/DisplayInfo.xml
similarity index 59%
rename from docs/en/Xamarin.Essentials/ScreenMetrics.xml
rename to docs/en/Xamarin.Essentials/DisplayInfo.xml
index 0bf967535..aa2d49a6d 100644
--- a/docs/en/Xamarin.Essentials/ScreenMetrics.xml
+++ b/docs/en/Xamarin.Essentials/DisplayInfo.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -11,7 +11,7 @@
- System.IEquatable<Xamarin.Essentials.ScreenMetrics>
+ System.IEquatable<Xamarin.Essentials.DisplayInfo>
@@ -20,36 +20,62 @@
- This type represents the properties of the current screen.
+ Represents information about the screen.
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ Main constructor for Display Information
+ To be added.
+
+
-
+
Property
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
System.Double
- Gets a value representing the current screen density.
-
-
-
- This value is a multiple value, such that a retina display would be 2.0 or 3.0. On Windows, the scaling percent of 200% means that the density will be 2.0.
+ Gets a value representing the screen density.
+ The screen density.
+
+
+
-
+
Method
Xamarin.Essentials
@@ -62,18 +88,18 @@
- Object to compare
- If equal to another object
- If equal
+ Object to compare.
+ If equal to another object.
+ If equal.
-
-
-
+
+
+
Method
M:System.IEquatable`1.Equals(`0)
@@ -86,19 +112,21 @@
System.Boolean
-
+
- The other ScreenMetrics
- If equal to another ScreenMetrics
- If equal
- To be added.
+ The other display info to compare.
+ If equal to another object.
+ If equal.
+
+
+
-
+
Method
Xamarin.Essentials
@@ -109,8 +137,8 @@
- Get the hash code for object.
- The hash code
+ Gets the hash code for object.
+ The hash code.
@@ -119,27 +147,27 @@
-
+
Property
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
System.Double
Gets the height of the screen for the current orientation.
-
-
-
- This value is the height after rotation, so a landscape iPhone will have a smaller height than width.
+ The height in pixels.
+
+
+
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -149,13 +177,13 @@
System.Boolean
-
-
+
+
- Left to compare
- Right to compare
- Equality operator for equals
+ Left to compare.
+ Right to compare.
+ If equal to another object.
If equal
@@ -163,9 +191,9 @@
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -175,13 +203,13 @@
System.Boolean
-
-
+
+
- Left to check
- Right to check
- Inequality check
+ Left to compare
+ Right to compare
+ If not equal to another object.
If not equal
@@ -189,49 +217,49 @@
-
-
-
+
+
+
Property
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenOrientation
+ Xamarin.Essentials.DisplayOrientation
Gets the orientation of the device.
-
+ The orientation.
+
-
- If the device is a square device, then the orientation will be portrait.
+
-
-
-
+
+
+
Property
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenRotation
+ Xamarin.Essentials.DisplayRotation
- Gets the current rotation from the designed orientation.
-
+ Gets the rotation from the designated orientation.
+ The rotation
+
-
- This represents the degrees that the device has been rotated. For example, if this is a phone (which is designed for portrait) that has been rotated to landscape with the main buttoms to the right, then the device has been rotated to the left by 90 degrees.
+
-
+
Method
Xamarin.Essentials
@@ -242,29 +270,31 @@
- To be added.
- To be added.
- To be added.
+ String representation of information.
+ String information about display info.
+
+
+
-
+
Property
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
System.Double
- Gets the width of the screen in the current orientation.
-
-
-
- This value is the width after rotation, so a landscape Android phone will have a larget width than height.
+ Gets the width of the scrreen for the current orientation.
+ The width in pixels.
+
+
+
diff --git a/docs/en/Xamarin.Essentials/DisplayInfoChangedEventArgs.xml b/docs/en/Xamarin.Essentials/DisplayInfoChangedEventArgs.xml
new file mode 100644
index 000000000..8f382b7f1
--- /dev/null
+++ b/docs/en/Xamarin.Essentials/DisplayInfoChangedEventArgs.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.EventArgs
+
+
+
+ Main display information event arguments.
+
+
+
+
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ Main constructor for event args.
+ To be added.
+
+
+
+
+
+
+ Property
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DisplayInfo
+
+
+ Gets the current display info for the main display.
+ To be added.
+ To be added.
+
+
+
+
diff --git a/docs/en/Xamarin.Essentials/ScreenOrientation.xml b/docs/en/Xamarin.Essentials/DisplayOrientation.xml
similarity index 63%
rename from docs/en/Xamarin.Essentials/ScreenOrientation.xml
rename to docs/en/Xamarin.Essentials/DisplayOrientation.xml
index b4d2b5964..8a01604c2 100644
--- a/docs/en/Xamarin.Essentials/ScreenOrientation.xml
+++ b/docs/en/Xamarin.Essentials/DisplayOrientation.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -10,61 +10,61 @@
System.Enum
- Screen orientation.
+ Display Orientation
-
+
-
-
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenOrientation
+ Xamarin.Essentials.DisplayOrientation
2
- Screen is in landscape.
+ Display is in landscape.
-
-
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenOrientation
+ Xamarin.Essentials.DisplayOrientation
1
- Screen is in portrait.
+ Display is in portrait.
-
-
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenOrientation
+ Xamarin.Essentials.DisplayOrientation
0
- Unknown screen orientation.
+ Unknown display orientation.
diff --git a/docs/en/Xamarin.Essentials/ScreenRotation.xml b/docs/en/Xamarin.Essentials/DisplayRotation.xml
similarity index 58%
rename from docs/en/Xamarin.Essentials/ScreenRotation.xml
rename to docs/en/Xamarin.Essentials/DisplayRotation.xml
index 44b491b74..e83f10423 100644
--- a/docs/en/Xamarin.Essentials/ScreenRotation.xml
+++ b/docs/en/Xamarin.Essentials/DisplayRotation.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -10,7 +10,7 @@
System.Enum
- Screen rotation.
+ Display rotation.
@@ -18,71 +18,88 @@
-
-
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenRotation
+ Xamarin.Essentials.DisplayRotation
- 0
+ 1
Rotated 0 degrees.
-
-
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenRotation
+ Xamarin.Essentials.DisplayRotation
- 2
+ 3
Rotated 180 degrees.
-
-
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenRotation
+ Xamarin.Essentials.DisplayRotation
- 3
+ 4
- Rotated 270 degrees.
+ Rotated 270 degrees.
-
-
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
- Xamarin.Essentials.ScreenRotation
+ Xamarin.Essentials.DisplayRotation
- 1
+ 2
Rotated 90 degrees.
+
+
+
+
+ Field
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ Xamarin.Essentials.DisplayRotation
+
+ 0
+
+ Unknown display rotation.
+
+
diff --git a/docs/en/Xamarin.Essentials/EmailBodyFormat.xml b/docs/en/Xamarin.Essentials/EmailBodyFormat.xml
index 75ad87538..bf5ef9d29 100644
--- a/docs/en/Xamarin.Essentials/EmailBodyFormat.xml
+++ b/docs/en/Xamarin.Essentials/EmailBodyFormat.xml
@@ -28,7 +28,7 @@
1
- The email message body is HTML.
+ The email message body is HTML (not supported on UWP).
diff --git a/docs/en/Xamarin.Essentials/EmailMessage.xml b/docs/en/Xamarin.Essentials/EmailMessage.xml
index e36536e39..e6b7c4845 100644
--- a/docs/en/Xamarin.Essentials/EmailMessage.xml
+++ b/docs/en/Xamarin.Essentials/EmailMessage.xml
@@ -107,7 +107,7 @@
Xamarin.Essentials.EmailBodyFormat
- Gets or sets a value indicating whether the message is in plain text or HTML.
+ Gets or sets a value indicating whether the message is in plain text or HTML (not supported on UWP).
diff --git a/docs/en/Xamarin.Essentials/EnergySaverStatusChangedEventArgs.xml b/docs/en/Xamarin.Essentials/EnergySaverStatusChangedEventArgs.xml
index 08b3e468d..a01b7a0e5 100644
--- a/docs/en/Xamarin.Essentials/EnergySaverStatusChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/EnergySaverStatusChangedEventArgs.xml
@@ -15,6 +15,24 @@
To be added.
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
@@ -33,5 +51,24 @@
To be added.
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.String
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/FileSystem.xml b/docs/en/Xamarin.Essentials/FileSystem.xml
index 36ce375d9..44ffac9b4 100644
--- a/docs/en/Xamarin.Essentials/FileSystem.xml
+++ b/docs/en/Xamarin.Essentials/FileSystem.xml
@@ -12,9 +12,7 @@
Provides an easy way to access the locations for device folders.
-
-
-
+
@@ -72,9 +70,7 @@
the name of the file to load from the app package.
Opens a stream to a file contained withing the app package.
Returns a stream to the file.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/Geocoding.xml b/docs/en/Xamarin.Essentials/Geocoding.xml
index e0d732f8f..4fd2f8d30 100644
--- a/docs/en/Xamarin.Essentials/Geocoding.xml
+++ b/docs/en/Xamarin.Essentials/Geocoding.xml
@@ -12,9 +12,7 @@
Easily convert between geographic coordinated and place names.
-
-
-
+
@@ -38,9 +36,7 @@
List of locations that best match the address or null if none found.
-
-
-
+
@@ -62,9 +58,7 @@
Location to find placemarks for.
Retrieve placemarks for a given location.
List of placemarks or null if no placemarks are found.
-
-
-
+
@@ -88,27 +82,7 @@
Longitude of the location.
Retrieve location for a given address.
List of placemarks or null if no placemarks are found.
-
-
-
-
-
-
-
-
-
- Property
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.String
-
-
- Get or sets the map API key.
- The current key for maps.
- Needed only for UWP and can be generated from Bing Maps.
+
diff --git a/docs/en/Xamarin.Essentials/GeolocationAccuracy.xml b/docs/en/Xamarin.Essentials/GeolocationAccuracy.xml
index 2c5f8b46e..8bda73613 100644
--- a/docs/en/Xamarin.Essentials/GeolocationAccuracy.xml
+++ b/docs/en/Xamarin.Essentials/GeolocationAccuracy.xml
@@ -16,7 +16,7 @@
-
+
Field
@@ -26,14 +26,31 @@
Xamarin.Essentials.GeolocationAccuracy
- 4
+ 5
Represents the best accuracy, using the most power to obtain and typically within 10 meters.
+
+
+
+
+ Field
+
+ 1.0.0.0
+ Xamarin.Essentials
+
+
+ Xamarin.Essentials.GeolocationAccuracy
+
+ 0
+
+ Represents default accuracy (Medium), typically within 30-500 meters.
+
+
-
+
Field
@@ -43,14 +60,14 @@
Xamarin.Essentials.GeolocationAccuracy
- 3
+ 4
Represents high accuracy, typically within 10-100 meters.
-
+
Field
@@ -60,14 +77,14 @@
Xamarin.Essentials.GeolocationAccuracy
- 1
+ 2
Represents low accuracy, typically within 300-3000 meters.
-
+
Field
@@ -77,14 +94,14 @@
Xamarin.Essentials.GeolocationAccuracy
- 0
+ 1
Represents the lowest accuracy, using the least power to obtain and typically within 1000-5000 meters.
-
+
Field
@@ -94,7 +111,7 @@
Xamarin.Essentials.GeolocationAccuracy
- 2
+ 3
Represents medium accuracy, typically within 30-500 meters.
diff --git a/docs/en/Xamarin.Essentials/Gyroscope.xml b/docs/en/Xamarin.Essentials/Gyroscope.xml
index 3823ed938..7f4a836b3 100644
--- a/docs/en/Xamarin.Essentials/Gyroscope.xml
+++ b/docs/en/Xamarin.Essentials/Gyroscope.xml
@@ -12,9 +12,7 @@
Gyroscope data of the rotation around the device's three primary axis.
-
-
-
+
@@ -32,9 +30,7 @@
Gets if gyro is being monitored.
If monitoring.
-
-
-
+
@@ -51,9 +47,7 @@
Event triggered when reading of sensor changes.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/GyroscopeChangedEventArgs.xml b/docs/en/Xamarin.Essentials/GyroscopeChangedEventArgs.xml
index 2d575a86a..c3bca848a 100644
--- a/docs/en/Xamarin.Essentials/GyroscopeChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/GyroscopeChangedEventArgs.xml
@@ -12,11 +12,27 @@
Event arguments containing the current reading.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/GyroscopeData.xml b/docs/en/Xamarin.Essentials/GyroscopeData.xml
index 973870075..9fc1f3061 100644
--- a/docs/en/Xamarin.Essentials/GyroscopeData.xml
+++ b/docs/en/Xamarin.Essentials/GyroscopeData.xml
@@ -21,11 +21,53 @@
Gyroscope information.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
@@ -39,7 +81,7 @@
System.Numerics.Vector3
- Gets the angular velocity vector in rad/s.
+ Gets the angular velocity vector in radians per second.
diff --git a/docs/en/Xamarin.Essentials/Location.xml b/docs/en/Xamarin.Essentials/Location.xml
index f5df9f533..a58457031 100644
--- a/docs/en/Xamarin.Essentials/Location.xml
+++ b/docs/en/Xamarin.Essentials/Location.xml
@@ -12,9 +12,7 @@
The latitude, longitude, and time information reported by the device.
-
-
-
+
@@ -29,9 +27,7 @@
Constructor for a location.
-
-
-
+
@@ -49,9 +45,7 @@
Location to copy values from.
Constructor for a location.
-
-
-
+
@@ -71,9 +65,7 @@
Default latitude for location.
Default longitude for location.
Constructor for a location.
-
-
-
+
@@ -95,9 +87,7 @@
Default longitude for location.
Timestamp for the location (Utc based).
Constructor for a location.
-
-
-
+
@@ -115,9 +105,7 @@
Gets or sets the accuracy (in meters) of the location.
The location accuracy.
-
-
-
+
@@ -161,9 +149,7 @@
Units to return.
Calculate distance between two locations.
Distance between two locations in the unit selected.
-
-
-
+
@@ -191,9 +177,7 @@
Unit to return.
Calculate distance between two locations.
Distance calculated.
-
-
-
+
@@ -221,14 +205,12 @@
Unit to use.
Calculate distance between two locations.
Distance calculated.
-
-
-
+
-
-
+
+
Method
@@ -253,9 +235,7 @@
Units to return.
Calculate distance between two locations.
Distance between two locations in the unit selected.
-
-
-
+
@@ -278,32 +258,6 @@
-
-
-
-
- Method
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.Double
-
-
-
-
-
-
- Kilometers to convert to miles.
-
- Convert kilometers to miles.
- Miles conversion from kilometers.
-
-
-
-
-
@@ -319,9 +273,7 @@
Gets or sets the latitude of location.
Latitude of the location.
-
-
-
+
@@ -339,33 +291,7 @@
Gets or sets the longitude of location.
Longitude of the location.
-
-
-
-
-
-
-
-
-
- Method
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.Double
-
-
-
-
-
- Miles to be converted.
- Converts miles to kilometers.
- Value of miles converted to kilometers.
-
-
-
+
@@ -383,9 +309,7 @@
Speed in meters per second.
Speed measured by the device..
-
-
-
+
@@ -403,9 +327,7 @@
Gets or sets the timestamp of the location.
UTC timestamp.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/LocationExtensions.xml b/docs/en/Xamarin.Essentials/LocationExtensions.xml
index d4075a93b..db5cac94b 100644
--- a/docs/en/Xamarin.Essentials/LocationExtensions.xml
+++ b/docs/en/Xamarin.Essentials/LocationExtensions.xml
@@ -12,9 +12,7 @@
Location Extensions
-
-
-
+
@@ -40,9 +38,7 @@
Units to use during calculation.
Extension to calculate distance from location to another location.
Distance in units fro two locations.
-
-
-
+
@@ -70,9 +66,7 @@
Units to use.
Extension to calculate distance from location to another location.
Distance calculated.
-
-
-
+
@@ -98,9 +92,9 @@
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -111,7 +105,7 @@
-
+
Location to open to.
diff --git a/docs/en/Xamarin.Essentials/Magnetometer.xml b/docs/en/Xamarin.Essentials/Magnetometer.xml
index c12210ff6..0142cbef5 100644
--- a/docs/en/Xamarin.Essentials/Magnetometer.xml
+++ b/docs/en/Xamarin.Essentials/Magnetometer.xml
@@ -11,10 +11,8 @@
- Detect device's orentation relative to Earth's magnetic field.
-
-
-
+ Detect device's orentation relative to Earth's magnetic field in microteslas (µ).
+
@@ -90,9 +88,7 @@
Stop monitoring for changes to magnetometer.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/MagnetometerChangedEventArgs.xml b/docs/en/Xamarin.Essentials/MagnetometerChangedEventArgs.xml
index 72becd2d3..6e72867aa 100644
--- a/docs/en/Xamarin.Essentials/MagnetometerChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/MagnetometerChangedEventArgs.xml
@@ -12,11 +12,27 @@
Event arguments containing the current reading.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
@@ -32,9 +48,7 @@
Gets the reading of the magnetometer.
The reading.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/MagnetometerData.xml b/docs/en/Xamarin.Essentials/MagnetometerData.xml
index 53e9d44a9..bb84c5c82 100644
--- a/docs/en/Xamarin.Essentials/MagnetometerData.xml
+++ b/docs/en/Xamarin.Essentials/MagnetometerData.xml
@@ -21,11 +21,53 @@
Data for magnetometer changes.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
@@ -111,7 +153,7 @@
System.Numerics.Vector3
- Gets the magnetic field vector in microteslas.
+ Gets the magnetic field vector in microteslas (µ).
diff --git a/docs/en/Xamarin.Essentials/MainThread.xml b/docs/en/Xamarin.Essentials/MainThread.xml
index c383d456a..259cb3519 100644
--- a/docs/en/Xamarin.Essentials/MainThread.xml
+++ b/docs/en/Xamarin.Essentials/MainThread.xml
@@ -33,9 +33,7 @@
Action to execute.
Invokes an action on the main thread of the application.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/Maps.xml b/docs/en/Xamarin.Essentials/Map.xml
similarity index 82%
rename from docs/en/Xamarin.Essentials/Maps.xml
rename to docs/en/Xamarin.Essentials/Map.xml
index 59f6eeb03..00a2666bb 100644
--- a/docs/en/Xamarin.Essentials/Maps.xml
+++ b/docs/en/Xamarin.Essentials/Map.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -12,15 +12,13 @@
Map helpers to open a route to specified places via default platforms maps implementation.
-
-
-
+
-
+
Method
Xamarin.Essentials
@@ -36,15 +34,13 @@
Location to open on maps.
Open the installed application to a specific location.
Task to be completed.
-
-
-
+
-
+
Method
Xamarin.Essentials
@@ -60,13 +56,13 @@
Placemark to open on maps.
Open the installed application to a specific placemark.
Task to be completed.
- To be added.
+
-
+
Method
Xamarin.Essentials
@@ -84,15 +80,13 @@
Longitude to open to.
Open the installed application to a specific location.
Task to be completed.
-
-
-
+
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -103,22 +97,20 @@
-
+
Location to open maps to.
Launch options to use.
Open the installed application to a specific location with launch options.
Task to be completed.
-
-
-
+
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -129,22 +121,20 @@
-
+
Placemark to open maps to.
Launch options to use.
Open the installed application to a specific placemark with launch options..
Task to be completed.
-
-
-
+
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -156,7 +146,7 @@
-
+
Latitude to open to.
diff --git a/docs/en/Xamarin.Essentials/MapsLaunchOptions.xml b/docs/en/Xamarin.Essentials/MapLaunchOptions.xml
similarity index 72%
rename from docs/en/Xamarin.Essentials/MapsLaunchOptions.xml
rename to docs/en/Xamarin.Essentials/MapLaunchOptions.xml
index 4c3b49ee3..0f84727c8 100644
--- a/docs/en/Xamarin.Essentials/MapsLaunchOptions.xml
+++ b/docs/en/Xamarin.Essentials/MapLaunchOptions.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -16,9 +16,9 @@
-
+
-
+
Constructor
Xamarin.Essentials
@@ -30,43 +30,41 @@
To be added.
-
-
-
-
+
+
+
+
Property
Xamarin.Essentials
1.0.0.0
- Xamarin.Essentials.MapDirectionsMode
+ System.String
- Directions mode to launch maps for navigation.
- Gets the mode.
-
-
-
+ Name of destination to display to user.
+ Gets the name.
+
-
-
-
-
+
+
+
+
Property
Xamarin.Essentials
1.0.0.0
- System.String
+ Xamarin.Essentials.NavigationMode
- Name of destination to display to user.
- Gets the name.
+ The navigation mode to use.
+ Gets the navigation mode.
-
+
diff --git a/docs/en/Xamarin.Essentials/MapDirectionsMode.xml b/docs/en/Xamarin.Essentials/NavigationMode.xml
similarity index 70%
rename from docs/en/Xamarin.Essentials/MapDirectionsMode.xml
rename to docs/en/Xamarin.Essentials/NavigationMode.xml
index 2269f2804..10171bd08 100644
--- a/docs/en/Xamarin.Essentials/MapDirectionsMode.xml
+++ b/docs/en/Xamarin.Essentials/NavigationMode.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -10,7 +10,7 @@
System.Enum
- Directions mode for navigation.
+ Represents various modes of navigation.
Default is none.
@@ -18,49 +18,49 @@
-
-
+
+
Field
Xamarin.Essentials
1.0.0.0
- Xamarin.Essentials.MapDirectionsMode
+ Xamarin.Essentials.NavigationMode
- 1
+ 2
Bicycle route mode.
-
-
+
+
Field
Xamarin.Essentials
1.0.0.0
- Xamarin.Essentials.MapDirectionsMode
+ Xamarin.Essentials.NavigationMode
- 2
+ 1
- The default directions mode on the platform.
+ The default navigation mode on the platform.
-
-
+
+
Field
Xamarin.Essentials
1.0.0.0
- Xamarin.Essentials.MapDirectionsMode
+ Xamarin.Essentials.NavigationMode
3
@@ -69,32 +69,32 @@
-
-
+
+
Field
Xamarin.Essentials
1.0.0.0
- Xamarin.Essentials.MapDirectionsMode
+ Xamarin.Essentials.NavigationMode
0
- No directions mode for map.
+ No navigation mode for map.
-
-
+
+
Field
Xamarin.Essentials
1.0.0.0
- Xamarin.Essentials.MapDirectionsMode
+ Xamarin.Essentials.NavigationMode
4
@@ -103,15 +103,15 @@
-
-
+
+
Field
Xamarin.Essentials
1.0.0.0
- Xamarin.Essentials.MapDirectionsMode
+ Xamarin.Essentials.NavigationMode
5
diff --git a/docs/en/Xamarin.Essentials/OrientationSensor.xml b/docs/en/Xamarin.Essentials/OrientationSensor.xml
index aa17dd9ae..e12381fc9 100644
--- a/docs/en/Xamarin.Essentials/OrientationSensor.xml
+++ b/docs/en/Xamarin.Essentials/OrientationSensor.xml
@@ -12,9 +12,7 @@
Device orientation (quaternion) relative to magnetic fields.
-
-
-
+
@@ -32,9 +30,7 @@
Gets of currently monitoring the sensor.
If monitoring.
-
-
-
+
@@ -53,9 +49,7 @@
Event triggered when reading of sensor changes.
-
-
-
+
@@ -76,9 +70,7 @@
Sensor speed to use.
Starts monitoring orientation sensor with specific speed.
-
-
-
+
@@ -96,9 +88,7 @@
Stops monitoring.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/OrientationSensorChangedEventArgs.xml b/docs/en/Xamarin.Essentials/OrientationSensorChangedEventArgs.xml
index 60de9f558..9c5b5ac8d 100644
--- a/docs/en/Xamarin.Essentials/OrientationSensorChangedEventArgs.xml
+++ b/docs/en/Xamarin.Essentials/OrientationSensorChangedEventArgs.xml
@@ -12,11 +12,27 @@
Orientation event args when reading changes.
-
-
-
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/OrientationSensorData.xml b/docs/en/Xamarin.Essentials/OrientationSensorData.xml
index 056bde1f7..ad5cca0ac 100644
--- a/docs/en/Xamarin.Essentials/OrientationSensorData.xml
+++ b/docs/en/Xamarin.Essentials/OrientationSensorData.xml
@@ -26,6 +26,54 @@
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Constructor
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
diff --git a/docs/en/Xamarin.Essentials/PhoneDialer.xml b/docs/en/Xamarin.Essentials/PhoneDialer.xml
index e7164399c..fd9c00e3e 100644
--- a/docs/en/Xamarin.Essentials/PhoneDialer.xml
+++ b/docs/en/Xamarin.Essentials/PhoneDialer.xml
@@ -12,9 +12,7 @@
Open the platform phone dialer to place a call.
-
-
-
+
@@ -36,7 +34,7 @@
Phone number to initialize the dialer with. Example 15555555555
Open the phone dialer to a specific phone number.
- Throws ArgumentNullException if number is not valid.Throws FeatureNotSupportedException if placing phone call is not supported on the device.
+ Throws ArgumentNullException if number is not valid.Throws FeatureNotSupportedException if placing phone call is not supported on the device.
diff --git a/docs/en/Xamarin.Essentials/Placemark.xml b/docs/en/Xamarin.Essentials/Placemark.xml
index 58b52bfc3..c46d96289 100644
--- a/docs/en/Xamarin.Essentials/Placemark.xml
+++ b/docs/en/Xamarin.Essentials/Placemark.xml
@@ -12,9 +12,7 @@
User-friendly description of a geographic coordinate. This contains information such as the name of the place, its address, and other information.
-
-
-
+
@@ -29,9 +27,7 @@
Default constructor for placemark.
-
-
-
+
@@ -49,9 +45,7 @@
Placemark to copy.
Constructor to create a deep copy.
-
-
-
+
@@ -69,9 +63,7 @@
Gets or sets the administrative area name of the address, for example, "CA", or null if it is unknown.
The admin area.
-
-
-
+
@@ -89,9 +81,7 @@
Gets or sets the country ISO code.
The country ISO code.
-
-
-
+
@@ -109,9 +99,7 @@
Gets or sets the country name.
The country name.
-
-
-
+
@@ -129,9 +117,7 @@
Gets or sets the feature name.
The feature name.
-
-
-
+
@@ -149,9 +135,7 @@
Gets or sets the city or town.
The city or town of the locality.
-
-
-
+
@@ -169,9 +153,7 @@
Gets or sets the location of the placemark.
The location of the palcemark.
-
-
-
+
@@ -189,9 +171,7 @@
Gets or sets the postal code.
The postal code.
-
-
-
+
@@ -209,9 +189,7 @@
Gets or sets the sub-administrative area name of the address, for example, "Santa Clara County", or null if it is unknown.
The sub-admin area.
-
-
-
+
@@ -229,9 +207,7 @@
Gets or sets the sub locality.
The sub locality.
-
-
-
+
@@ -249,9 +225,7 @@
Gets or sets optional info: sub street or region.
The sub thoroughfare.
-
-
-
+
@@ -269,9 +243,7 @@
Gets or sets the street name.
The street name.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml b/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml
index bcfc64612..25ac91ece 100644
--- a/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml
+++ b/docs/en/Xamarin.Essentials/PlacemarkExtensions.xml
@@ -38,9 +38,9 @@
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -51,7 +51,7 @@
-
+
To be added.
diff --git a/docs/en/Xamarin.Essentials/Platform.xml b/docs/en/Xamarin.Essentials/Platform.xml
index 2be0e01ac..e808bf0d6 100644
--- a/docs/en/Xamarin.Essentials/Platform.xml
+++ b/docs/en/Xamarin.Essentials/Platform.xml
@@ -35,9 +35,7 @@
Application to initialize with.
Initialize Xamarin.Essentials with Android's application class.
-
-
-
+
@@ -60,9 +58,25 @@
Activity to use for initialization.
Bundle of the activity.
Initialize Xamarin.Essentials with Android's activity and bundle.
-
-
-
+
+
+
+
+
+
+
+ Property
+
+ 1.0.0.0
+ Xamarin.Essentials
+
+
+ System.String
+
+
+ Get or sets the map API key.
+ The current key for maps.
+ Needed only for UWP and can be generated from Bing Maps.
diff --git a/docs/en/Xamarin.Essentials/Power.xml b/docs/en/Xamarin.Essentials/Power.xml
deleted file mode 100644
index 1b742eacf..000000000
--- a/docs/en/Xamarin.Essentials/Power.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.Object
-
-
-
- Access to device specific power settings.
-
-
-
-
-
-
-
-
-
- Property
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- Xamarin.Essentials.EnergySaverStatus
-
-
- Gets the current energy saver status of the device.
- The current status of energy saver mode.
-
-
-
-
-
-
-
-
-
- Event
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.EventHandler<Xamarin.Essentials.EnergySaverStatusChangedEventArgs>
-
-
- Event that is triggered when energy saver status changes.
-
-
-
-
-
-
-
diff --git a/docs/en/Xamarin.Essentials/ScreenLock.xml b/docs/en/Xamarin.Essentials/ScreenLock.xml
deleted file mode 100644
index d1a33c039..000000000
--- a/docs/en/Xamarin.Essentials/ScreenLock.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.Object
-
-
-
- Provides an easy way to keep the device screen on.
-
-
-
-
-
-
-
- Property
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.Boolean
-
-
- Gets a value that indicates whether the device's screen will stay on.
-
-
-
-
-
-
-
-
- Method
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.Void
-
-
-
- Indicate that the device's screen should stay on.
-
-
-
-
-
-
-
- Method
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- System.Void
-
-
-
- Indicate that the device's screen can turn off.
-
-
-
-
-
diff --git a/docs/en/Xamarin.Essentials/ScreenMetricsChangedEventArgs.xml b/docs/en/Xamarin.Essentials/ScreenMetricsChangedEventArgs.xml
deleted file mode 100644
index efa7f5ad1..000000000
--- a/docs/en/Xamarin.Essentials/ScreenMetricsChangedEventArgs.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
- Xamarin.Essentials
- 1.0.0.0
-
-
- System.EventArgs
-
-
-
- Screen metric event arguments.
-
-
-
-
-
-
-
-
-
- Constructor
-
- 1.0.0.0
- Xamarin.Essentials
-
-
-
-
-
- New screen metrics.
- Constructor that takes new screen matrics.
-
-
-
-
-
-
-
-
-
- Property
-
- 1.0.0.0
- Xamarin.Essentials
-
-
- Xamarin.Essentials.ScreenMetrics
-
-
- Gets the new screen metrics.
- The screen metrics.
-
-
-
-
-
-
-
diff --git a/docs/en/Xamarin.Essentials/SecureStorage.xml b/docs/en/Xamarin.Essentials/SecureStorage.xml
index 73ce698fc..7e25522ad 100644
--- a/docs/en/Xamarin.Essentials/SecureStorage.xml
+++ b/docs/en/Xamarin.Essentials/SecureStorage.xml
@@ -66,9 +66,7 @@
Storage Key.
Gets the decrypted value for a given Key.
Decrypted string.
-
-
-
+
@@ -131,12 +129,8 @@
Storage Key.
The value to be encrypted.
Stores the value which is encrypted, for a given Key.
-
-
-
-
-
-
+
+
@@ -161,12 +155,8 @@
The value to be encrypted.
The KeyChain accessibility to create the encrypted record with.
Stores the value which is encrypted, for a given Key. iOS override to specify SecAccessible for the KeyChain.
-
-
-
-
-
-
+
+
diff --git a/docs/en/Xamarin.Essentials/SensorSpeed.xml b/docs/en/Xamarin.Essentials/SensorSpeed.xml
index cebfc84f7..8f6fca722 100644
--- a/docs/en/Xamarin.Essentials/SensorSpeed.xml
+++ b/docs/en/Xamarin.Essentials/SensorSpeed.xml
@@ -11,32 +11,30 @@
Sensor speed to monitor for changes.
-
-
-
+
-
-
-
-
+
+
+
+
Field
- 1.0.0.0
Xamarin.Essentials
+ 1.0.0.0
Xamarin.Essentials.SensorSpeed
0
- Get the sensor data as fast as possible.
+ To be added.
-
-
-
-
+
+
+
+
Field
1.0.0.0
@@ -45,15 +43,15 @@
Xamarin.Essentials.SensorSpeed
- 1
+ 3
- Rate suitable for games.
+ Get the sensor data as fast as possible.
-
-
-
-
+
+
+
+
Field
1.0.0.0
@@ -62,14 +60,14 @@
Xamarin.Essentials.SensorSpeed
- 3
+ 2
- Default rate suitable for screen orientation changes.
+ Rate suitable for games.
-
+
Field
@@ -79,7 +77,7 @@
Xamarin.Essentials.SensorSpeed
- 2
+ 1
Rate suitable for general user interface.
diff --git a/docs/en/Xamarin.Essentials/Share.xml b/docs/en/Xamarin.Essentials/Share.xml
index 607a06fef..00ecae6f7 100644
--- a/docs/en/Xamarin.Essentials/Share.xml
+++ b/docs/en/Xamarin.Essentials/Share.xml
@@ -60,9 +60,7 @@
Share request with options.
Show the share user interface to share text or uri.
Task when completed.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/ShareTextRequest.xml b/docs/en/Xamarin.Essentials/ShareTextRequest.xml
index 279a544d1..54dfc4e7a 100644
--- a/docs/en/Xamarin.Essentials/ShareTextRequest.xml
+++ b/docs/en/Xamarin.Essentials/ShareTextRequest.xml
@@ -29,9 +29,7 @@
Default constructor.
-
-
-
+
diff --git a/docs/en/Xamarin.Essentials/SpeakSettings.xml b/docs/en/Xamarin.Essentials/SpeechOptions.xml
similarity index 88%
rename from docs/en/Xamarin.Essentials/SpeakSettings.xml
rename to docs/en/Xamarin.Essentials/SpeechOptions.xml
index da954c82d..406b6ba30 100644
--- a/docs/en/Xamarin.Essentials/SpeakSettings.xml
+++ b/docs/en/Xamarin.Essentials/SpeechOptions.xml
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Xamarin.Essentials
1.0.0.0
@@ -11,14 +11,14 @@
- Text to Speech Settings.
+ Text-to-speech options.
-
+
-
+
Constructor
Xamarin.Essentials
@@ -33,7 +33,7 @@
-
+
Property
Xamarin.Essentials
@@ -51,7 +51,7 @@
-
+
Property
Xamarin.Essentials
@@ -69,7 +69,7 @@
-
+
Property
Xamarin.Essentials
diff --git a/docs/en/Xamarin.Essentials/TextToSpeech.xml b/docs/en/Xamarin.Essentials/TextToSpeech.xml
index de17802ee..3c37b371d 100644
--- a/docs/en/Xamarin.Essentials/TextToSpeech.xml
+++ b/docs/en/Xamarin.Essentials/TextToSpeech.xml
@@ -53,15 +53,15 @@
The text to speak..
Optional cancellation token to stop speaking.
- Speaks the given text with default settings.
+ Speaks the given text with default options.
-
-
-
+
+
+
Method
Xamarin.Essentials
@@ -72,14 +72,14 @@
-
+
The text to speak.
- The settings to use for speaking.
+ The options to use for speaking.
Optional cancellation token to stop speaking.
- Speaks the given text with the specified settings.
+ Speaks the given text with the specified options.
diff --git a/docs/en/Xamarin.Essentials/UnitConverters.xml b/docs/en/Xamarin.Essentials/UnitConverters.xml
new file mode 100644
index 000000000..ada05eeb4
--- /dev/null
+++ b/docs/en/Xamarin.Essentials/UnitConverters.xml
@@ -0,0 +1,537 @@
+
+
+
+
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Object
+
+
+
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
+
+
+ Method
+
+ Xamarin.Essentials
+ 1.0.0.0
+
+
+ System.Double
+
+
+
+
+
+ To be added.
+ To be added.
+ To be added.
+ To be added.
+
+
+
+
diff --git a/docs/en/index.xml b/docs/en/index.xml
index d379781fd..db14fb81b 100644
--- a/docs/en/index.xml
+++ b/docs/en/index.xml
@@ -50,9 +50,6 @@
System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName="")
-
- System.Reflection.AssemblyInformationalVersion("1.0.0+8db259fd337f910db5b9158f8ab6b5cdbb783499")
-
System.Runtime.CompilerServices.InternalsVisibleTo("XamarinEssentialsDeviceTestsShared")
@@ -80,6 +77,9 @@
System.Runtime.Versioning.TargetFramework(".NETCore,Version=v5.0", FrameworkDisplayName=".NET for Windows Universal")
+
+ System.Reflection.AssemblyInformationalVersion("1.0.0+6cbf633fff1449502abe23bcb054e7575ea6e214")
+
@@ -95,7 +95,7 @@
-
+
@@ -107,12 +107,15 @@
-
+
-
-
+
+
+
+
+
@@ -138,9 +141,9 @@
-
-
-
+
+
+
@@ -151,20 +154,16 @@
-
-
-
-
-
-
+
-
+
+
@@ -252,23 +251,23 @@
-
-
-
+
+
+
ExtensionMethod
System.Threading.Tasks.Task
-
+
Location to open to.
Options to use.
Open maps to this location.
-
+
@@ -298,23 +297,23 @@
-
-
-
+
+
+
ExtensionMethod
System.Threading.Tasks.Task
-
+
To be added.
To be added.
To be added.
-
+
diff --git a/nugetreadme.txt b/nugetreadme.txt
index 8acb381d4..9397f3709 100644
--- a/nugetreadme.txt
+++ b/nugetreadme.txt
@@ -12,7 +12,11 @@ http://aka.ms/essentials-getstarted
## Release Notes
-See our full release notes: http://aka.ms/essentials-releasenotes
+This preview contains several breaking API changes as we approach our GA release.
+
+We have documented a full transition guide when migrating from older versions.
+
+See our full release notes for more information: http://aka.ms/essentials-releasenotes
## Feedback, Issues, & Feature Requests