@@ -34,18 +34,19 @@ if (pspdfkitPassword == null || pspdfkitPassword == '') {
3434 throw new GradleException (" PSPDFKit password was not specified. The password is required to download the PSPDFKit AAR file into your project. Please specify as pspdfkit.password inside the local.properties file." )
3535}
3636
37+ ext. pspdfkitVersion = localProperties. getProperty(' pspdfkit.version' )
38+ if (pspdfkitVersion == null || pspdfkitVersion == ' ' ) {
39+ ext. pspdfkitVersion = ' 5.5.0'
40+ }
41+
3742def pspdfkitIsDemo = localProperties. getProperty(' pspdfkit.demo' )
3843if (pspdfkitIsDemo == null ) {
3944 pspdfkitIsDemo = pspdfkitPassword. startsWith(' TRIAL-' )
4045} else {
4146 pspdfkitIsDemo = Boolean . parseBoolean(pspdfkitIsDemo)
4247}
4348
44- ext. pspdfkitMavenModuleName = pspdfkitIsDemo ? ' pspdfkit-demo' : ' pspdfkit'
45- ext. pspdfkitVersion = localProperties. getProperty(' pspdfkit.version' )
46- if (pspdfkitVersion == null || pspdfkitVersion == ' ' ) {
47- ext. pspdfkitVersion = ' 5.5.0'
48- }
49+ ext. pspdfkitMavenModuleName = (pspdfkitIsDemo && ! useUnifiedBinaries(ext. pspdfkitVersion)) ? ' pspdfkit-demo' : ' pspdfkit'
4950
5051ext. pspdfkitFlutterVersion = ' 1.0.0-SNAPSHOT'
5152
@@ -54,3 +55,19 @@ ext.androidBuildToolsVersion = '28.0.3'
5455ext. androidMinSdkVersion = 19
5556ext. androidTargetSdkVersion = 28
5657ext. androidGradlePluginVersion = ' 3.4.2'
58+
59+ // Returns true when version1 is more recent than or equals to version2.
60+ boolean isMoreRecentOrEqual (String version1 , String version2 ) {
61+ [version1,version2]* . tokenize(' .' )* . collect { it as int }. with { u , v ->
62+ Integer result = [u,v]. transpose(). findResult{ x ,y -> x <=> y ?: null } ?: u. size() <=> v. size()
63+ return (result == 1 || result == 0 )
64+ }
65+ }
66+
67+ // Starting from version 5.5.0 we moved to a simplified model
68+ // that uses unified binaries when on trial and in production
69+ // https://pspdfkit.com/blog/2019/pspdfkit-android-5-5/#simplified-integration
70+ boolean useUnifiedBinaries (String version ) {
71+ String versionUnified = ' 5.5.0'
72+ return isMoreRecentOrEqual(version, versionUnified)
73+ }
0 commit comments