wn-na / react-native-capture-protection

It’s a library for React Native to control simple capture events(i.e. Screenshot or Screen record)
https://www.npmjs.com/package/react-native-capture-protection
MIT License
102 stars 10 forks source link

loaded Android Gradle Plugin Conditionally #18

Closed SaeedZhiany closed 1 year ago

SaeedZhiany commented 1 year ago

This wraps the Android Gradle plugin dependency in the buildscripts section of android/build.gradle in a conditional:

if (project == rootProject) {
    // ... (dependency here)
}

The Android Gradle plugin is only required when opening the project stand-alone, not when it is included as a dependency. By doing this, the project opens correctly in Android Studio, and it can also be consumed as a native module dependency from an application project without affecting the app project (avoiding unnecessary downloads/conflicts/etc).

for more info, you can refer to this thread and especially this comment.

wn-na commented 1 year ago

Thanks for the great way to do it :) It's nice to get rid of an unnecessary step.

I'll include this in the next 1.8.0 release. LGTM @SaeedZhiany