diff --git a/.editorconfig b/.editorconfig index 6101444e..43dad41b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -55,7 +55,7 @@ dotnet_naming_rule.methods_and_properties_must_be_pascal_case.symbols = method_a dotnet_naming_rule.methods_and_properties_must_be_pascal_case.style = pascal_case_style # Non-public members must be lower-case -dotnet_naming_symbols.non_public_symbols.applicable_kinds = property,method,field,event,delegate +dotnet_naming_symbols.non_public_symbols.applicable_kinds = field,event,delegate dotnet_naming_symbols.non_public_symbols.applicable_accessibilities = private dotnet_naming_style.all_lower_case_style.capitalization = camel_case diff --git a/src/Media.Plugin/iOS/MediaPickerDelegate.cs b/src/Media.Plugin/iOS/MediaPickerDelegate.cs index 11ae17be..433f774e 100644 --- a/src/Media.Plugin/iOS/MediaPickerDelegate.cs +++ b/src/Media.Plugin/iOS/MediaPickerDelegate.cs @@ -9,7 +9,6 @@ using Foundation; using UIKit; using NSAction = System.Action; -using System.Globalization; using ImageIO; using MobileCoreServices; using System.Drawing; @@ -41,10 +40,7 @@ public UIPopoverController Popover set; } - public void CancelTask() - { - tcs.SetResult(null); - } + public void CancelTask() => tcs.SetResult(null); public UIView View => viewController.View; @@ -130,7 +126,7 @@ public void DisplayPopover(bool hideFirst = false) if (IsValidInterfaceOrientation(UIDevice.CurrentDevice.Orientation)) orientation = UIDevice.CurrentDevice.Orientation; else - orientation = GetDeviceOrientation(viewController.InterfaceOrientation); + orientation = getDeviceOrientation(viewController.InterfaceOrientation); } double x, y; @@ -151,14 +147,14 @@ public void DisplayPopover(bool hideFirst = false) Popover.PresentFromRect(new CGRect(x, y, width, height), View, 0, animated: true); } - private UIDeviceOrientation? orientation; - private NSObject observer; - private readonly UIViewController viewController; - private readonly UIImagePickerControllerSourceType source; - private TaskCompletionSource> tcs = new TaskCompletionSource>(); - private readonly StoreCameraMediaOptions options; + UIDeviceOrientation? orientation; + NSObject observer; + readonly UIViewController viewController; + readonly UIImagePickerControllerSourceType source; + TaskCompletionSource> tcs = new TaskCompletionSource>(); + readonly StoreCameraMediaOptions options; - private bool IsCaptured => + bool IsCaptured => source == UIImagePickerControllerSourceType.Camera; private void Dismiss(UINavigationController picker, NSAction onDismiss) @@ -229,29 +225,29 @@ private void DidRotate(NSNotification notice) private bool GetShouldRotate(UIDeviceOrientation orientation) { - var iorientation = UIInterfaceOrientation.Portrait; + UIInterfaceOrientation iOrientation; switch (orientation) { case UIDeviceOrientation.LandscapeLeft: - iorientation = UIInterfaceOrientation.LandscapeLeft; + iOrientation = UIInterfaceOrientation.LandscapeLeft; break; case UIDeviceOrientation.LandscapeRight: - iorientation = UIInterfaceOrientation.LandscapeRight; + iOrientation = UIInterfaceOrientation.LandscapeRight; break; case UIDeviceOrientation.Portrait: - iorientation = UIInterfaceOrientation.Portrait; + iOrientation = UIInterfaceOrientation.Portrait; break; case UIDeviceOrientation.PortraitUpsideDown: - iorientation = UIInterfaceOrientation.PortraitUpsideDown; + iOrientation = UIInterfaceOrientation.PortraitUpsideDown; break; default: return false; } - return viewController.ShouldAutorotateToInterfaceOrientation(iorientation); + return viewController.ShouldAutorotateToInterfaceOrientation(iOrientation); } private bool GetShouldRotate6(UIDeviceOrientation orientation) @@ -259,7 +255,7 @@ private bool GetShouldRotate6(UIDeviceOrientation orientation) if (!viewController.ShouldAutorotate()) return false; - var mask = UIInterfaceOrientationMask.Portrait; + UIInterfaceOrientationMask mask; switch (orientation) { case UIDeviceOrientation.LandscapeLeft: @@ -619,12 +615,12 @@ private async Task GetMovieMediaFile(NSDictionary info) return new MediaFile(path, () => File.OpenRead(path), albumPath: aPath); } - private static string GetUniquePath(string type, string path, string name, string pathExtension) + static string GetUniquePath(string type, string path, string name, string pathExtension) { var isPhoto = (type == MediaImplementation.TypeImage); var ext = Path.GetExtension(name); if (string.IsNullOrWhiteSpace(ext)) - ext = pathExtension; + ext = "." + pathExtension; if(string.IsNullOrWhiteSpace(ext)) ext = ((isPhoto) ? ".jpg" : ".mp4"); @@ -683,7 +679,7 @@ private static bool IsSameOrientationKind(UIDeviceOrientation o1, UIDeviceOrient return false; } - private static UIDeviceOrientation GetDeviceOrientation(UIInterfaceOrientation self) + private static UIDeviceOrientation getDeviceOrientation(UIInterfaceOrientation self) { switch (self) {