Sfoglia il codice sorgente

PRS MOBILE - potential fix to DF images rotating, for testing on iOS

Nick-PRSDigital@bitbucket.org 2 anni fa
parent
commit
e0fd662565

+ 1 - 1
prs.mobile/comal.timesheets.Android/Resources/Resource.designer.cs

@@ -14,7 +14,7 @@ namespace comal.timesheets.Droid
 {
 	
 	
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.2.8.165")]
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.0.0.73")]
 	public partial class Resource
 	{
 		

+ 6 - 11
prs.mobile/comal.timesheets/DigitalForms/CustomUserControls/EmbeddedImageCapture.cs

@@ -128,7 +128,6 @@ namespace comal.timesheets
                 {
                     CompressionQuality = 15,
                     PhotoSize = Plugin.Media.Abstractions.PhotoSize.Full,
-                    RotateImage = false
                 });
 
                 if (file == null)
@@ -160,7 +159,6 @@ namespace comal.timesheets
                     Name = filename,
                     CompressionQuality = 15,
                     PhotoSize = Plugin.Media.Abstractions.PhotoSize.Full,
-                    RotateImage = true,
                     SaveMetaData = false
                 });
 
@@ -181,16 +179,13 @@ namespace comal.timesheets
                 using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Adding Photo"))
                 {
                     var memoryStream = new MemoryStream();
-                    file.GetStream().CopyTo(memoryStream);
-                    var data = memoryStream.ToArray();
 
-                    //Document doc = new Document()
-                    //{
-                    //    FileName = Path.GetFileName(file.Path),
-                    //    Data = data,
-                    //    CRC = CoreUtils.CalculateCRC(data),
-                    //    TimeStamp = DateTime.Now
-                    //};
+                    if (Device.RuntimePlatform.Equals(Device.Android))                                       
+                        file.GetStream().CopyTo(memoryStream);                    
+                    else if (Device.RuntimePlatform.Equals(Device.iOS))                   
+                        file.GetStreamWithImageRotatedForExternalStorage().CopyTo(memoryStream);
+                    
+                    var data = memoryStream.ToArray();
 
                     DataToImage(data);
                 }

+ 7 - 3
prs.mobile/comal.timesheets/DigitalForms/CustomUserControls/MultiImageCapture.xaml.cs

@@ -46,7 +46,6 @@ namespace comal.timesheets
                     Name = filename,
                     CompressionQuality = 15,
                     PhotoSize = Plugin.Media.Abstractions.PhotoSize.Full,
-                    RotateImage = false,
                     SaveMetaData = false
                 }); ;
                 if (file == null)
@@ -71,7 +70,6 @@ namespace comal.timesheets
                 {
                     CompressionQuality = 15,
                     PhotoSize = Plugin.Media.Abstractions.PhotoSize.Full,
-                    RotateImage = false
                 });
                 if (file == null)
                     return;
@@ -92,8 +90,14 @@ namespace comal.timesheets
                 using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Adding Photo"))
                 {
                     var memoryStream = new MemoryStream();
-                    file.GetStream().CopyTo(memoryStream);
+
+                    if (Device.RuntimePlatform.Equals(Device.Android))
+                        file.GetStream().CopyTo(memoryStream);
+                    else if (Device.RuntimePlatform.Equals(Device.iOS))
+                        file.GetStreamWithImageRotatedForExternalStorage().CopyTo(memoryStream);
+
                     var data = memoryStream.ToArray();
+
                     DataToImage(data);
                 }
             }