Conversation
This comment has been minimized.
This comment has been minimized.
|
@syed-pelican @mattleibow ping, new pr same code |
|
and the merge failed..... |
…same media file as in other struct # Conflicts: # Xamarin.Essentials/Platform/Platform.android.cs
This comment has been minimized.
This comment has been minimized.
mattleibow
left a comment
There was a problem hiding this comment.
Thanks for this PR. It is much better than the last one and looks very good.
We did just add a new base FileBase type, so see if you can use that.
| { | ||
| internal static bool PlatformCanCapture => UIScreen.MainScreen != null; | ||
|
|
||
| static string GetTempFileName() |
There was a problem hiding this comment.
Can we make use of the members on the FileSystem type? If not, it might be better to add something there for other APIs to use.
There was a problem hiding this comment.
No, the current FileSystem type does not provide the necessary functionality. Adding it does sound like a good idea. See the other post
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…Essentials into feature/Screenshot
…to avoid ambiguieties on uwp.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…Essentials into feature/Screenshot
This comment has been minimized.
This comment has been minimized.
|
@newky2k Would you mind taking a look at it again? I added docs and removed the deprecated method. I really would like to not have to merge master changes on this many branches :) |
This comment has been minimized.
This comment has been minimized.
mattleibow
left a comment
There was a problem hiding this comment.
Very nice! I have a few comments, mostly things that popped to mind as I was reading. I do this this API, neat and clean.
This comment has been minimized.
This comment has been minimized.
…ot feature, changed method signature to be compatible with the picker as suggested. Also renamed mediafile to screenshotfile
This comment has been minimized.
This comment has been minimized.
|
@mattleibow I moved all files to the cache location, changed the icon and renamed the AsStream method including the signature change. Should be ready to go. |
This comment has been minimized.
This comment has been minimized.
| { | ||
| static bool PlatformCanCapture => !Platform.WindowManager.DefaultDisplay.Flags.HasFlag(DisplayFlags.Secure); | ||
|
|
||
| static string GetTempFileName() => Path.Combine(FileSystem.CacheDirectory, Path.GetTempFileName()); |
There was a problem hiding this comment.
@jamesmontemagno @Redth I am still not really happy with this... This folder is publicly available to the user, so should we be putting things in here? If the user does not expect this, what happens? Should we have a special folder in the cache where we work? Should we truly use some OS temp system?
@Mrnikbobjeff previously had it in the external storage folder, and I sort of felt it is better in the cache folder. I think it is better now, but maybe we need to decide on what we want to do with files we create.
There was a problem hiding this comment.
@Mrnikbobjeff I am thinking this is probably better to just be in the PlatformCaptureAsync method as it is a single line.
There was a problem hiding this comment.
An interesting question would be to see how to save files in the application cache folder, as the user can clear than themself.
There was a problem hiding this comment.
I would like to save this in the application cache folder, as the user can clear that manually
|
|
||
| static string GetTempFileName() | ||
| { | ||
| var tempFileName = Path.ChangeExtension(Path.Combine(FileSystem.CacheDirectory, Path.GetTempFileName()), ".png"); |
There was a problem hiding this comment.
To be consistent, we should probably use Path.Combine(FileSystem.CacheDirectory, Path.GetTempFileName()); like Android. Also, as it is a single line, just put it in the PlatformCaptureAsync method.
| static async Task<ScreenshotFile> PlatformCaptureAsync() | ||
| { | ||
| var element = Window.Current.Content as FrameworkElement; | ||
| var fileOnDisk = await ApplicationData.Current.LocalCacheFolder.CreateFileAsync(Path.ChangeExtension(Path.GetRandomFileName(), ".png")); |
There was a problem hiding this comment.
To be consistent, we should probably use Path.Combine(FileSystem.CacheDirectory, Path.GetTempFileName()); like Android.
There was a problem hiding this comment.
I actually prefer the uwp implementation over all others, as this allows the user to remove the cached data by cleaning app data.
There was a problem hiding this comment.
I like this more as the user can clear application cache directly
|
I think this is really close, that location where we save temp files is still bugging me. |
|
Should we use Context.CacheDir on Android? https://docs.microsoft.com/en-us/dotnet/api/android.content.context.cachedir?view=xamarin-android-sdk-9 |
|
Are there any plans to finally include this branch into the upcoming release? There has been virtually no developement on this branch except deciding where to store the file in the last 8 months. We are already rolling our own EssentialsEx package including this and other branches which remained virtually finished for quite a while. @jamesmontemagno @mattleibow |
|
Merged in #1356 |
Description of Change
API Changes
Added:
And the same media file as in #178
Docs update can come once we decide on the exact mediafile structure..
PR Checklist