Skip to content

Conversation

@MaelImhof
Copy link

Hi,

TL;DR : This is a fix for #486.

Change Log

I followed the instructions in this comment and used Gradle flavors so that it is easily configurable in Android Studio.

  • Added two flavors and a flavor dimension to the build.gradle of :bVNC, to build it withGoogle or withoutGoogle.
  • Created bVNC/src/withGoogle/.../GoogleUtils.java and bVNC/src/withoutGoogle/.../GoogleUtils.java, to isolate Google dependencies imports.
  • Moved the only function that used Google deps, showRateAppDialog, into GoogleUtils.java. When building withGoogle, it works as before, but for withoutGoogle it simply does nothing for now (should it log something? Let me know).
  • Removed Google deps imports from bVNC/src/main/java/com/iiordanov/bVNC/Utils.java. Removed the original declaration of showRateAppDialog as well.
  • Changed the only reference to showRateAppDialog in ConnectionGridActivity.java to a reference to the new GoogleUtils class.
  • Added flavors to the build.gradle file of the modules that use :bVNC, so that they know which flavor of :bVNC to use (otherwise it cannot be resolved when building).
  • Added a sub-section to the README to tell how to build without Google dependencies.

I tried to avoid having two GoogleUtils.java files, but I had problems with the Google deps imports that caused errors when building without Google.

Now, if you would prefer to keep everything in Utils.java, I might be able to figure something out with reflection if that sounds good enough to you, or search for something else, but right now the only solution I found to keep everything in one file is reflection.

Please let me know if anything is unclear or if you would like anything changed in the PR.

Cheers !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant