File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed
src/main/java/io/branch/referral Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,6 @@ jacoco {
1313 toolVersion = " 0.8.10"
1414}
1515
16- // configurations.all {
17- // resolutionStrategy {
18- // force("com.android.billingclient:billing:8.0.0")
19- // }
20- // }
21-
2216dependencies {
2317 implementation(fileTree(mapOf (" dir" to " libs" , " include" to " *.jar" )))
2418 implementation(kotlin(" stdlib" ))
Original file line number Diff line number Diff line change 22
33import java .lang .ClassNotFoundException ;
44
5+ import io .branch .referral .util .DependencyUtilsKt ;
6+
57public class BillingGooglePlayReflection {
68 public static BillingGooglePlayInterface getBillingLibraryVersion () {
7- String billingClient = com .android .billingclient .BuildConfig .VERSION_NAME ;
9+ String billingClientVersionString = com .android .billingclient .BuildConfig .VERSION_NAME ;
810 BillingGooglePlayInterface billingInterface ;
911
1012 try {
11- int majorIndex = billingClient .indexOf ("." );
12- String majorVersion = billingClient .substring (0 , majorIndex );
13-
14- switch (majorVersion ) {
13+ String billingMajorVersion = DependencyUtilsKt .dependencyMajorVersionFinder (billingClientVersionString );
14+ switch (billingMajorVersion ) {
1515 case "8" :
1616 billingInterface = new BillingGooglePlayV8 ();
1717 break ;
@@ -25,7 +25,7 @@ public static BillingGooglePlayInterface getBillingLibraryVersion() {
2525 }
2626
2727 } catch (Exception e ) {
28- System . err . println ("Error parsing billing client version: " + e .getMessage ());
28+ BranchLogger . e ("Error parsing billing client version: " + e .getMessage ());
2929
3030 billingInterface = new BillingGooglePlayDefault ();
3131 }
Original file line number Diff line number Diff line change @@ -29,4 +29,10 @@ const val xiaomiInstallReferrerClass = "com.miui.referrer.api.GetAppsReferrerCli
2929
3030const val billingGooglePlayClass = " com.android.billingclient.api.BillingClient"
3131
32- const val androidBrowserClass = " androidx.browser.customtabs.CustomTabsIntent"
32+ const val androidBrowserClass = " androidx.browser.customtabs.CustomTabsIntent"
33+
34+ fun dependencyMajorVersionFinder (dependencyNameString : String ): String {
35+ val majorIndex = dependencyNameString.indexOf(" ." )
36+ val majorVersion = dependencyNameString.substring(0 , majorIndex)
37+ return majorVersion
38+ }
You can’t perform that action at this time.
0 commit comments