dimonovdd / Xamarin.MediaGallery

This plugin is designed to picking and save images and video files from native gallery of Android and iOS devices and capture photos
MIT License
149 stars 18 forks source link

Album creation when saving assets #122

Open beeradmoore opened 1 year ago

beeradmoore commented 1 year ago

Summary

I find it odd that the project will create an album when saving data on Android but not with iOS. Currently there is no functionality to enable this behaviour.

I believe I can make these changes but I am currently unable to build the project from source (see #121).

API Changes

For all of the SaveAsync methods a new argument is added which indicates an album name to be used and/or created.

public static async Task SaveAsync(MediaFileType type, Stream fileStream, string fileName, string album = null)

It should be defaulted to null which will mean there are no breaking changes going forwards and the code would retain the same results (Android generates albums based on app name, iOS does not generate an album).

If an empty string is given then no album is created and the asset is saved in the root gallery/photo/video location.

If a string is provided then it will be used in place of albumName in Android and new code will be added on iOS to create the album. As far as I know no additional iOS permissions are required and I already have existing code to create albums on iOS so I should be able to plop that in.

I am unaware if there are issues of not saving to an album on Android and if that is why the app is made that way.

dimonovdd commented 1 year ago

Hi. I will be very glad if you do it.

Unfortunately, there is no need to create albums in my projects. I have added to this project only what I use myself. I will be able to create a preview version for nuget so that you can check these changes in your project.