Skip to content

Commit

Permalink
Rename old Xamarin -> MAUI android resource/provider (#4211)
Browse files Browse the repository at this point in the history
* Rename old Xamarin -> MAUI android resource/provider

We do not want this content provider to clash with the older essentials one, so renaming, along with the relevant resource.

* Apply suggestions from code review

* Update Preferences.shared.cs

Co-authored-by: James Montemagno <james.montemagno@gmail.com>
  • Loading branch information
Redth and jamesmontemagno authored Jan 20, 2022
1 parent 9e066ed commit 8799ae8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ static void DataUpdated(CMDeviceMotion data, NSError error)
// the quaternion returned by the MotionManager refers to a frame where the X axis points north ("iOS frame")
var q = new Quaternion((float)field.x, (float)field.y, (float)field.z, (float)field.w);

// in Xamarin, the reference frame is defined such that Y points north and Z is vertical,
// so we first rotate by 90 degrees around the Z axis, in order to get from the Xamarin frame to the iOS frame
// In .NET MAUI, the reference frame is defined such that Y points north and Z is vertical,
// so we first rotate by 90 degrees around the Z axis, in order to get from the .NET MAUI frame to the iOS frame
var qz90 = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, (float)(Math.PI / 2.0));

// on top of this rotation, we apply the actual quaternion obtained from the MotionManager,
// so that the final quaternion will take us from the earth frame in Xamarin convention to the phone frame
// so that the final quaternion will take us from the earth frame in .NET MAUI convention to the phone frame
q = Quaternion.Multiply(qz90, q);
var rotationData = new OrientationSensorData(q.X, q.Y, q.Z, q.W);
OnChanged(rotationData);
Expand Down
2 changes: 1 addition & 1 deletion src/Essentials/src/Preferences/Preferences.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Microsoft.Maui.Essentials
public static partial class Preferences
{
internal static string GetPrivatePreferencesSharedName(string feature) =>
$"{AppInfo.PackageName}.xamarinessentials.{feature}";
$"{AppInfo.PackageName}.microsoft.maui.essentials.{feature}";

// overloads

Expand Down
6 changes: 3 additions & 3 deletions src/Essentials/src/Types/FileProvider.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace Microsoft.Maui.Essentials
{
[ContentProvider(
new[] { "${applicationId}.fileProvider" },
Name = "xamarin.essentials.fileProvider",
Name = "microsoft.maui.essentials.fileProvider",
Exported = false,
GrantUriPermissions = true)]
[MetaData(
"android.support.FILE_PROVIDER_PATHS", // IMPORTANT: This string doesn't change with AndroidX
Resource = "@xml/xamarin_essentials_fileprovider_file_paths")]
Resource = "@xml/microsoft_maui_essentials_fileprovider_file_paths")]
public class FileProvider : ContentFileProvider
{
internal static bool AlwaysFailExternalMediaAccess { get; set; } = false;
Expand Down Expand Up @@ -64,7 +64,7 @@ internal static bool IsFileInPublicLocation(string filename)
var file = new Java.IO.File(filename);
filename = file.CanonicalPath;

// the shared paths from the "xamarin_essentials_fileprovider_file_paths.xml" resource
// the shared paths from the "microsoft_maui_essentials_fileprovider_file_paths.xml" resource
var publicLocations = new List<string>
{
#if __ANDROID_29__
Expand Down

0 comments on commit 8799ae8

Please sign in to comment.