natsuk4ze / gal

How to Save Image or Video to Photo Gallery in Flutter
https://pub.dev/packages/gal
BSD 3-Clause "New" or "Revised" License
105 stars 16 forks source link

Allow building macOS apps targeting 10.14 or 10.15 macOS version #173

Closed SleepySquash closed 10 months ago

SleepySquash commented 10 months ago

Proposal

gal requires macOS 11 (Big Sur) in order for the gallery saving to work at all. If Xcode project targets lower version (e.g. 10.14 or 10.15), then the project doesn't build. I suggest, if possible, allowing usage of gal on macOS targets lower than 11.0, and instead throw UnsupportedError, if gallery saving is not available. I wonder, whether .swift files will build at all, yet I see #available(iOS 14, macOS 11, *) directives in the source code, which my hope is based on.

Perhaps Gal.isSupported() might be added to know, whether gal is available (may include Linux and Web to that indicator, which are not supported by gal). It might be better, than adding conditions by the developer, as it wouldn't require checking whether the package updates to support the platform.

Use case

The primary reason of allowing lower macOS versions to run is simply the users base. According to market share, 3% to 5% of macOS in the world still are running 10.14 Mojave (perhaps a bit more running 10.15 Catalina). And Flutter supports macOS 10.14+.

natsuk4ze commented 10 months ago

Thank you for your contribution 🤝 @SleepySquash

There is a possibility to make macOS 10.15 the lowest supported version, but before that we need to investigate the API.

I wonder, whether .swift files will build at all

Yes. This is because the main function for saving, PHAssetChangeRequest in photo-kit, is only available on macOS 10.15 or later. See #146. For that reason, 10.14 and below will not be added to support at all at this time.

macOS targets lower than 11.0, and instead throw UnsupportedError Perhaps Gal.isSupported() might be added to know, whether gal is available

This does not look good for me. Users should check the supported version of a plugin and expect to be able to use all features within that version. They do not expect to get errors only with older versions.

SleepySquash commented 10 months ago

@natsuk4ze, oh, sorry for not noticing the issue you mentioned, it's my mistake, I apologise for your time taken.

Thank you for the detailed answer! After investigating the macOS Big Sur supported devices, I suppose, it doesn't really make sense to target 10.15 instead of 11.0. Main reason I hoped for version downgrade is Mojave, as it is the last macOS to support 32 bit applications, and some users may stick with it only because of that. And since that doesn't work out, I guess, everything is ok.

They do not expect to get errors only with older versions

Well, I do agree. It is indeed better to know the package works on every OS version the application is built for.

I'm closing the issue. Thank you for your time!

natsuk4ze commented 10 months ago

I'm closing the issue. Thank you for your time!

You're welcome. Thanks again for your contribution 😊 @SleepySquash