Apparence-io / CamerAwesome

๐Ÿ“ธ Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
920 stars 208 forks source link

๐Ÿ”ง Expose play services location version #234

Closed apalala-dev closed 1 year ago

apalala-dev commented 1 year ago

Description

Plugins might have compatibility problems with play-services-location version. We used v21 but it includes a breaking change and can't work with v20. This change let users define which version they want to use in gradle.

Checklist

Before creating any Pull Request, confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).

Breaking Change

If your feature break something, please detail it

christocracy commented 1 year ago

LGTM.

However, for future-proofing, you should also implement an ext var for this one too (all androidx deps should be considered candidates, excluding those related to testing). You donโ€™t have to document all your vars but at least itโ€™s available in an emergency, where the user can fix their problem in their appโ€™s Config, rather than having to fix it in the plugin. If the user doesnโ€™t define it in their android/build.gradle, you just fallback to your defined DEFAULT_EXIF_INTERFACE_VERSION = โ€œ1.3.5โ€.

Eg: ext.exifInterfaceVersion

'androidx.exifinterface:exifinterface:1.3.5'
christocracy commented 1 year ago

And this one, as well (itโ€™s almost implemented anyway):

ext.cameraVersion?

def camerax_version = "1.2.0"
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"
    implementation "androidx.camera:camera-video:${camerax_version}"

    implementation "androidx.camera:camera-view:${camerax_version}"
    implementation "androidx.camera:camera-extensions:${camerax_version}"
apalala-dev commented 1 year ago

Thanks for your feedback! Greatly appreciate ๐Ÿ™

While I agree that adding more configuration to the gradle file is nice, I think that we should add some minimal version as well. In our case, camerax changes a lot for instance and we tend to use the latest version because of its new features. However, if someone overrides to use a lower version that didn't include a feature that we use, I guess it will break ?

I thought about adding some guards like you did yourself:

def locationMajorVersion = playServicesLocationVersion.split('\\.')[0] as int
if (locationMajorVersion > 20) {
    println("*****************************************************");
    println("* [WARNING] background-geolocation requires a maximum googlePlayServicesLocationVersion of 20.0.0 due to breaking changes in v21");;
    println("* googlePlayServicesLocationVersion has been overridden to $DEFAULT_PLAY_SERVICES_LOCATION_VERSION");
    println("*****************************************************");
    playServicesLocationVersion = DEFAULT_PLAY_SERVICES_LOCATION_VERSION
}

Among the fields I'd like to make more customizable with a minimal version check, there are:

Fields that might be customizable:

Although I am not sure about these.

christocracy commented 1 year ago

In our case, camerax changes a lot

Sure. Itโ€™s probably unusual for a developer to use multiple camera plugins.